Now with skipping consecutive links
This commit is contained in:
@@ -17,8 +17,10 @@ pub mod ffi {
|
|||||||
fn decrement(self: Pin<&mut Module>);
|
fn decrement(self: Pin<&mut Module>);
|
||||||
fn get_name(self: &Module) -> String;
|
fn get_name(self: &Module) -> String;
|
||||||
fn increment(self: Pin<&mut Module>);
|
fn increment(self: Pin<&mut Module>);
|
||||||
|
fn is_skip_consecutive_links(self: &Module) -> bool;
|
||||||
fn render_text(self: Pin<&mut Module>) -> String;
|
fn render_text(self: Pin<&mut Module>) -> String;
|
||||||
fn set_key_text(self: Pin<&mut Module>, key_text: &String) -> ();
|
fn set_key_text(self: Pin<&mut Module>, key_text: &String) -> ();
|
||||||
|
fn set_skip_consecutive_links(self: Pin<&mut Module>, skip: bool);
|
||||||
fn strip_text(self: Pin<&mut Module>) -> String;
|
fn strip_text(self: Pin<&mut Module>) -> String;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -15,6 +15,10 @@ namespace sword_rs {
|
|||||||
this->module->increment();
|
this->module->increment();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Module::is_skip_consecutive_links() const {
|
||||||
|
return this->module->isSkipConsecutiveLinks();
|
||||||
|
}
|
||||||
|
|
||||||
rust::String Module::render_text() {
|
rust::String Module::render_text() {
|
||||||
return std::string(
|
return std::string(
|
||||||
(const char*) this->module->renderText()
|
(const char*) this->module->renderText()
|
||||||
@@ -22,8 +26,12 @@ namespace sword_rs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Module::set_key_text(const rust::String& keyText) {
|
void Module::set_key_text(const rust::String& keyText) {
|
||||||
this->module->setKeyText(std::string(keyText).c_str());
|
this->module->setKeyText(std::string(keyText).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Module::set_skip_consecutive_links(bool skip) {
|
||||||
|
this->module->setSkipConsecutiveLinks(skip);
|
||||||
|
}
|
||||||
|
|
||||||
rust::String Module::strip_text() {
|
rust::String Module::strip_text() {
|
||||||
return std::string(
|
return std::string(
|
||||||
|
|||||||
@@ -19,10 +19,14 @@ namespace sword_rs {
|
|||||||
|
|
||||||
void increment();
|
void increment();
|
||||||
|
|
||||||
|
bool is_skip_consecutive_links() const;
|
||||||
|
|
||||||
rust::String render_text();
|
rust::String render_text();
|
||||||
|
|
||||||
void set_key_text(const rust::String& keyText);
|
void set_key_text(const rust::String& keyText);
|
||||||
|
|
||||||
|
void set_skip_consecutive_links(bool skip);
|
||||||
|
|
||||||
rust::String strip_text();
|
rust::String strip_text();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ fn main() {
|
|||||||
let random_number: i32 = rand::rng().random_range(1..=20);
|
let random_number: i32 = rand::rng().random_range(1..=20);
|
||||||
let random_number_str = format!("John.3.{}", random_number);
|
let random_number_str = format!("John.3.{}", random_number);
|
||||||
module.set_key_text(&random_number_str);
|
module.set_key_text(&random_number_str);
|
||||||
|
module.set_skip_consecutive_links(true);
|
||||||
for i in 0..10 {
|
for i in 0..10 {
|
||||||
module.increment();
|
module.increment();
|
||||||
println!(
|
println!(
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ impl Module {
|
|||||||
self.module.pin_mut().increment();
|
self.module.pin_mut().increment();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_skip_consecutive_links(&self) -> bool {
|
||||||
|
self.module.is_skip_consecutive_links()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn render_text(&mut self) -> String {
|
pub fn render_text(&mut self) -> String {
|
||||||
self.module.pin_mut().render_text()
|
self.module.pin_mut().render_text()
|
||||||
}
|
}
|
||||||
@@ -30,6 +34,10 @@ impl Module {
|
|||||||
self.module.pin_mut().set_key_text(key_text);
|
self.module.pin_mut().set_key_text(key_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_skip_consecutive_links(&mut self, skip: bool) {
|
||||||
|
self.module.pin_mut().set_skip_consecutive_links(skip);
|
||||||
|
}
|
||||||
|
|
||||||
pub fn strip_text(&mut self) -> String {
|
pub fn strip_text(&mut self) -> String {
|
||||||
self.module.pin_mut().strip_text()
|
self.module.pin_mut().strip_text()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user