Trait tiny_std::AsUnixStr

source ·
pub trait AsUnixStr: ToUnixString {
    // Required methods
    fn exec_with_self_as_ptr<F, T>(&self, func: F) -> Result<T, Error>
       where F: FnOnce(*const u8) -> Result<T, Error>;
    unsafe fn match_up_to(&self, null_terminated_pointer: *const u8) -> usize;
}

Required Methods§

source

fn exec_with_self_as_ptr<F, T>(&self, func: F) -> Result<T, Error>where F: FnOnce(*const u8) -> Result<T, Error>,

Executes a function with this null terminated entity converts it to a string and pushes a null byte if not already null terminated

Errors

Propagates the function’s errors

source

unsafe fn match_up_to(&self, null_terminated_pointer: *const u8) -> usize

Checks if this AsUnixStr matches a null terminated pointer and returns the non null length

Safety

Pointer is null terminated

Implementations on Foreign Types§

source§

impl AsUnixStr for &mut [u8]

source§

fn exec_with_self_as_ptr<F, T>(&self, func: F) -> Result<T, Error>where F: FnOnce(*const u8) -> Result<T, Error>,

source§

unsafe fn match_up_to(&self, null_terminated_pointer: *const u8) -> usize

source§

impl AsUnixStr for &[u8]

source§

fn exec_with_self_as_ptr<F, T>(&self, func: F) -> Result<T, Error>where F: FnOnce(*const u8) -> Result<T, Error>,

source§

unsafe fn match_up_to(&self, null_terminated_pointer: *const u8) -> usize

source§

impl<A> AsUnixStr for &mut Awhere A: AsUnixStr,

source§

fn exec_with_self_as_ptr<F, T>(&self, func: F) -> Result<T, Error>where F: FnOnce(*const u8) -> Result<T, Error>,

source§

unsafe fn match_up_to(&self, null_terminated_pointer: *const u8) -> usize

source§

impl AsUnixStr for &str

source§

fn exec_with_self_as_ptr<F, T>(&self, func: F) -> Result<T, Error>where F: FnOnce(*const u8) -> Result<T, Error>,

source§

unsafe fn match_up_to(&self, null_terminated_pointer: *const u8) -> usize

source§

impl AsUnixStr for ()

source§

fn exec_with_self_as_ptr<F, T>(&self, func: F) -> Result<T, Error>where F: FnOnce(*const u8) -> Result<T, Error>,

source§

unsafe fn match_up_to(&self, _null_terminated_pointer: *const u8) -> usize

source§

impl AsUnixStr for Vec<u8, Global>

source§

fn exec_with_self_as_ptr<F, T>(&self, func: F) -> Result<T, Error>where F: FnOnce(*const u8) -> Result<T, Error>,

source§

unsafe fn match_up_to(&self, null_terminated_pointer: *const u8) -> usize

source§

impl<A> AsUnixStr for &Awhere A: AsUnixStr,

source§

fn exec_with_self_as_ptr<F, T>(&self, func: F) -> Result<T, Error>where F: FnOnce(*const u8) -> Result<T, Error>,

source§

unsafe fn match_up_to(&self, null_terminated_pointer: *const u8) -> usize

source§

impl AsUnixStr for &mut str

source§

fn exec_with_self_as_ptr<F, T>(&self, func: F) -> Result<T, Error>where F: FnOnce(*const u8) -> Result<T, Error>,

source§

unsafe fn match_up_to(&self, null_terminated_pointer: *const u8) -> usize

source§

impl AsUnixStr for String

source§

fn exec_with_self_as_ptr<F, T>(&self, func: F) -> Result<T, Error>where F: FnOnce(*const u8) -> Result<T, Error>,

source§

unsafe fn match_up_to(&self, null_terminated_pointer: *const u8) -> usize

Implementors§