#[repr(C)]pub struct txt {
pub b: *const c_char,
pub e: *const c_char,
}Expand description
txt (vas.h needed for the macros)
Fields§
§b: *const c_char§e: *const c_charImplementations§
Source§impl txt
impl txt
Sourcepub fn from_str(s: &str) -> Self
pub fn from_str(s: &str) -> Self
FIXME: This method is only used when calling crate::ffi::VSLbt,
and current implementation creates a string without a null terminator to pass it in.
Going forward, we should probably refactor it to avoid extra string allocation.
pub fn from_cstr(s: &CStr) -> Self
Sourcepub fn to_slice(&self) -> Option<&[u8]>
pub fn to_slice(&self) -> Option<&[u8]>
Convert the txt struct to a &[u8].
We want to explicitly differentiate between empty (None) and null (Some([])) strings.
Sourcepub fn to_str(&self) -> Option<StrOrBytes<'_>>
pub fn to_str(&self) -> Option<StrOrBytes<'_>>
Convert the txt struct to a StrOrBytes enum.
Sourcepub fn parse_header(&self) -> Option<(&str, StrOrBytes<'_>)>
pub fn parse_header(&self) -> Option<(&str, StrOrBytes<'_>)>
Parse the txt struct as a header, returning a tuple with the key and value,
trimming the value of leading whitespace.
Trait Implementations§
Auto Trait Implementations§
impl !Send for txt
impl !Sync for txt
impl Freeze for txt
impl RefUnwindSafe for txt
impl Unpin for txt
impl UnsafeUnpin for txt
impl UnwindSafe for txt
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