pub struct StringSplicer<'a, T: Bytes> { /* private fields */ }
Expand description
Implementations§
Source§impl<'a, T: Bytes> StringSplicer<'a, T>
impl<'a, T: Bytes> StringSplicer<'a, T>
Sourcepub fn assemble(self) -> OsString
pub fn assemble(self) -> OsString
Assembles the final string by appending individual items without any other processing.
Sourcepub fn assemble_with_sep(self, sep: impl Bytes) -> OsString
pub fn assemble_with_sep(self, sep: impl Bytes) -> OsString
Places a separator between all the elements that are spliced into the string.
Sourcepub fn assemble_with_wrap(self, wrap: impl Bytes) -> OsString
pub fn assemble_with_wrap(self, wrap: impl Bytes) -> OsString
Wraps all items with the provided value before inserting them into the string.
Sourcepub fn assemble_with_sep_and_wrap(
self,
sep: impl Bytes,
wrap: impl Bytes,
) -> OsString
pub fn assemble_with_sep_and_wrap( self, sep: impl Bytes, wrap: impl Bytes, ) -> OsString
Wraps all items with the provided value and places the separator item between the individual elements.
§Examples
use std::ffi::OsStr;
use osstrtools::{OsStrTools, StringSplicer};
let strings: &[&OsStr] = &[OsStr::new("/foo/bar"),
OsStr::new("/baz/")];
let s = OsStr::new("rm #");
let mut splicer = s.splice("#", strings);
let result = splicer.assemble_with_sep_and_wrap(" ", "'");
assert_eq!(result, "rm '/foo/bar' '/baz/'");
Auto Trait Implementations§
impl<'a, T> Freeze for StringSplicer<'a, T>
impl<'a, T> RefUnwindSafe for StringSplicer<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for StringSplicer<'a, T>where
T: Sync,
impl<'a, T> Sync for StringSplicer<'a, T>where
T: Sync,
impl<'a, T> Unpin for StringSplicer<'a, T>
impl<'a, T> UnwindSafe for StringSplicer<'a, T>where
T: RefUnwindSafe,
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more