pub enum Str<'a> {
Int(i64),
Bytes(&'a [u8]),
}Expand description
A stored value, read back out of a record.
The point of the two arms is that neither of them copies. An integer comes
back as an integer and is written into the reply buffer as digits at the
moment the reply is built, and a string comes back as a slice of the record
it lives in. Y18 asks for the reply to be constructed once in wire form, and
a Vec<u8> in the middle of that is the thing it is asking to remove.
Variants§
Implementations§
Source§impl Str<'_>
impl Str<'_>
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
How many bytes this value is as a string, which is what STRLEN returns.
Sourcepub fn write_to(&self, out: &mut Vec<u8>)
pub fn write_to(&self, out: &mut Vec<u8>)
Append the string form to a buffer, which for an integer is its digits.
Sourcepub fn to_vec(&self) -> Vec<u8> ⓘ
pub fn to_vec(&self) -> Vec<u8> ⓘ
The string form, copied. For the reply path prefer Str::write_to.
Trait Implementations§
impl<'a> Copy for Str<'a>
impl<'a> Eq for Str<'a>
impl<'a> StructuralPartialEq for Str<'a>
Auto Trait Implementations§
impl<'a> Freeze for Str<'a>
impl<'a> RefUnwindSafe for Str<'a>
impl<'a> Send for Str<'a>
impl<'a> Sync for Str<'a>
impl<'a> Unpin for Str<'a>
impl<'a> UnsafeUnpin for Str<'a>
impl<'a> UnwindSafe for Str<'a>
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