[−][src]Struct linux_loader::cmdline::Cmdline
A builder for a kernel command line string that validates the string as it's being built.
A CString can be constructed from this directly using CString::new.
Examples
let cl = Cmdline::new(100); let cl_cstring = CString::new(cl).unwrap(); assert_eq!(cl_cstring.to_str().unwrap(), "");
Implementations
impl Cmdline[src]
pub fn new(capacity: usize) -> Cmdline[src]
Constructs an empty Cmdline with the given capacity, including the nul terminator.
Arguments
capacity- Command line capacity. Must be greater than 0.
Examples
let cl = Cmdline::new(100);
pub fn insert<T: AsRef<str>>(&mut self, key: T, val: T) -> Result<()>[src]
Validates and inserts a key-value pair into this command line.
Arguments
key- Key to be inserted in the command line string.val- Value corresponding tokey.
Examples
let mut cl = Cmdline::new(100); cl.insert("foo", "bar"); let cl_cstring = CString::new(cl).unwrap(); assert_eq!(cl_cstring.to_str().unwrap(), "foo=bar");
pub fn insert_str<T: AsRef<str>>(&mut self, slug: T) -> Result<()>[src]
Validates and inserts a string to the end of the current command line.
Arguments
slug- String to be appended to the command line.
Examples
let mut cl = Cmdline::new(100); cl.insert_str("foobar"); let cl_cstring = CString::new(cl).unwrap(); assert_eq!(cl_cstring.to_str().unwrap(), "foobar");
pub fn as_str(&self) -> &str[src]
Returns the string representation of the command line without the nul terminator.
Examples
let mut cl = Cmdline::new(10); cl.insert_str("foobar"); assert_eq!(cl.as_str(), "foobar");
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Cmdline
impl Send for Cmdline
impl Sync for Cmdline
impl Unpin for Cmdline
impl UnwindSafe for Cmdline
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,