From d6906a9380f0bc92df29a3ea138d8bd368c29017 Mon Sep 17 00:00:00 2001 From: Cookiebowser <lucas.doering@live.de> Date: Thu, 7 Jul 2022 14:10:41 +0200 Subject: [PATCH] added missing BString implementation --- .../src/main/rust/btypes/src/bstring.rs | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/btypes_primitives/src/main/rust/btypes/src/bstring.rs b/btypes_primitives/src/main/rust/btypes/src/bstring.rs index e49302b41..62a0ee4b3 100644 --- a/btypes_primitives/src/main/rust/btypes/src/bstring.rs +++ b/btypes_primitives/src/main/rust/btypes/src/bstring.rs @@ -1,5 +1,6 @@ use std::fmt::{Display, Formatter}; use crate::bobject::BObject; +use crate::bboolean::BBoolean; #[derive(Default, Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct BString { @@ -16,4 +17,26 @@ impl Display for BString { } } -impl BObject for BString {} \ No newline at end of file +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); + } +} -- GitLab