Struct bstr::BArray
[−]
[src]
pub struct BArray<A>(_) where A: Array<OLECHAR>;
Array backed BSTR
.
Enables stack allocated bstr literals, albeit with ugly syntax.
No Cow
-like behaviour as it's meant for small bstr literals, simply panics if the string being stored doesn't fit in the backing array.
The number of ‘characters’ is limited to array capacity - 3.
Examples
Create an empty literal.
let empty = BArray::<[_; 8]>::new(); assert!(empty.is_empty());
Create a bstr literal.
let lit = BArray::<[_; 16]>::from("BStr Literal"); assert_eq!(lit.as_ref(), "BStr Literal");
Methods
impl<A: Array<OLECHAR>> BArray<A>
[src]
fn new() -> BArray<A>
Creates an empty string.
fn set<T: AsRef<OsStr>>(&mut self, sty: T)
Sets the backing array to a new string.
Panics if string doesn't fit in the backing array.
fn set_from<T: IntoIterator<Item=OLECHAR>>(&mut self, ty: T)
Sets the backing array to a new string.
Panics if string doesn't fit in the backing array.
Methods from Deref<Target=BStr>
fn to_os_string(&self) -> OsString
Clones the string encoded as OsString
.
Trait Implementations
impl<A: Array<OLECHAR>> Default for BArray<A>
[src]
impl<A: Array<OLECHAR>, T: AsRef<OsStr>> From<T> for BArray<A>
[src]
impl<A: Array<OLECHAR>> FromIterator<OLECHAR> for BArray<A>
[src]
fn from_iter<T: IntoIterator<Item=OLECHAR>>(ty: T) -> BArray<A>
Creates a value from an iterator. Read more
impl<A: Array<OLECHAR>> AsRef<BStr> for BArray<A>
[src]
impl<A: Array<OLECHAR>> Deref for BArray<A>
[src]
type Target = BStr
The resulting type after dereferencing
fn deref(&self) -> &BStr
The method called to dereference a value