Skip to content
Snippets Groups Projects
Commit d6906a93 authored by Cookiebowser's avatar Cookiebowser
Browse files

added missing BString implementation

parent b8e9ecf1
No related branches found
No related tags found
1 merge request!28Rust support
use std::fmt::{Display, Formatter}; use std::fmt::{Display, Formatter};
use crate::bobject::BObject; use crate::bobject::BObject;
use crate::bboolean::BBoolean;
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] #[derive(Default, Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct BString { pub struct BString {
...@@ -17,3 +18,25 @@ impl Display for BString { ...@@ -17,3 +18,25 @@ impl Display for BString {
} }
impl BObject for BString {} impl BObject for BString {}
impl BString {
pub fn new(init: &str) -> BString {
return BString { val: String::from(init) }
}
pub fn isString(&self) -> BBoolean {
return true;
}
pub fn isNotString(&self) -> BBoolean {
return false;
}
pub fn equal(&self, other: &BString) -> BBoolean {
return self.eq(other);
}
pub fn unequal(&self, other: &BString) -> BBoolean {
return !self.eq(other);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment