pub struct Str {
pub value: String,
}Expand description
Haystack Str
Example
Create Str value
use libhaystack::val::*;
// Create `Str` from `&str` primitive
let str_value = Value::from(Str::from("sample string"));
assert!(str_value.is_str());
// Get the `Str` value from the Value
assert_eq!(Str::try_from(&str_value).unwrap(), Str::from("sample string"));
// Get a std::String from a Value
assert_eq!(String::try_from(&str_value).unwrap(), "sample string");
// Create `Str` from literal
let str:Str = "sample string".into();
assert_eq!(str.as_str(), "sample string");Fields§
§value: StringImplementations§
Trait Implementations§
source§impl<'de> Deserialize<'de> for Str
impl<'de> Deserialize<'de> for Str
Hayson Str deserializer
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Str, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Str, D::Error>
Deserialize this value from the given Serde deserializer. Read more
source§impl Ord for Str
impl Ord for Str
source§impl PartialOrd for Str
impl PartialOrd for Str
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl Eq for Str
impl StructuralEq for Str
impl StructuralPartialEq for Str
Auto Trait Implementations§
impl RefUnwindSafe for Str
impl Send for Str
impl Sync for Str
impl Unpin for Str
impl UnwindSafe for Str
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more