[−][src]Struct windy::AString
Represents ANSI string.
Implementations
impl AString
[src]
pub fn as_bytes_with_nul(&self) -> &[u8]
[src]
pub fn as_bytes(&self) -> &[u8]
[src]
pub fn as_c_str(&self) -> &AStr
[src]
pub unsafe fn as_mut_c_str(&mut self) -> &mut AStr
[src]
Returns &mut AStr
.
pub fn as_ptr(&self) -> *const u8
[src]
pub fn len(&self) -> usize
[src]
pub unsafe fn new_unchecked<T: Into<Vec<u8>>>(v: T) -> Self
[src]
Creates AString
from v
without any encoding checks.
pub unsafe fn new_nul_unchecked<T: Into<Vec<u8>>>(v: T) -> Self
[src]
Creates AString
from v
without a null-terminated check.
Safety
v
must be a null-terminated ANSI string.
pub fn from_str(x: &str) -> ConvertResult<Self>
[src]
Converts &str
to AString
.
Example
use windy::AString; let s = AString::from_str("test").unwrap(); println!("{:?}", s);
pub fn from_str_lossy(x: &str) -> Self
[src]
Converts &str
to AString
.
Example
use windy::AString; let s = AString::from_str_lossy("test🍣"); println!("{:?}", s);
pub unsafe fn from_raw(ptr: *mut u8) -> ManuallyDrop<Self>
[src]
pub unsafe fn from_raw_s(ptr: *mut u8, len: usize) -> ManuallyDrop<Self>
[src]
pub unsafe fn clone_from_raw(ptr: *mut u8) -> Self
[src]
pub unsafe fn clone_from_raw_s(ptr: *mut u8, len: usize) -> Self
[src]
Methods from Deref<Target = AStr>
pub fn as_ptr(&self) -> *const i8
[src]
pub fn as_u8_ptr(&self) -> *const u8
[src]
pub fn len(&self) -> usize
[src]
pub fn to_bytes_with_nul(&self) -> &[u8]
[src]
pub fn to_bytes(&self) -> &[u8]
[src]
pub fn to_string(&self) -> ConvertResult<String>
[src]
pub fn to_string_lossy(&self) -> String
[src]
pub fn to_wstring(&self) -> ConvertResult<WString>
[src]
Returns ConvertError::ConvertToUnicodeError
if an input cannot be converted to a wide char.
Example
use windy::{AString, WString}; let s = WString::from_str("test").unwrap(); let s2 = AString::from_str("test").unwrap().to_wstring().unwrap(); assert_eq!(s, s2);
pub fn to_wstring_lossy(&self) -> WString
[src]
Trait Implementations
impl Clone for AString
[src]
impl Debug for AString
[src]
impl Deref for AString
[src]
impl Drop for AString
[src]
impl Eq for AString
[src]
impl Hash for AString
[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Index<RangeFull> for AString
[src]
type Output = AStr
The returned type after indexing.
pub fn index(&self, _: RangeFull) -> &Self::Output
[src]
impl Ord for AString
[src]
pub fn cmp(&self, other: &AString) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<AString> for AString
[src]
impl PartialOrd<AString> for AString
[src]
pub fn partial_cmp(&self, other: &AString) -> Option<Ordering>
[src]
pub fn lt(&self, other: &AString) -> bool
[src]
pub fn le(&self, other: &AString) -> bool
[src]
pub fn gt(&self, other: &AString) -> bool
[src]
pub fn ge(&self, other: &AString) -> bool
[src]
impl StructuralEq for AString
[src]
impl StructuralPartialEq for AString
[src]
impl<'_> TryFrom<&'_ AString> for WString
[src]
type Error = ConvertError
The type returned in the event of a conversion error.
pub fn try_from(x: &AString) -> Result<Self, Self::Error>
[src]
impl<'_> TryFrom<&'_ String> for AString
[src]
type Error = ConvertError
The type returned in the event of a conversion error.
pub fn try_from(x: &String) -> Result<Self, Self::Error>
[src]
impl<'_> TryFrom<&'_ WStr> for AString
[src]
type Error = ConvertError
The type returned in the event of a conversion error.
pub fn try_from(x: &WStr) -> Result<Self, Self::Error>
[src]
impl<'_> TryFrom<&'_ WString> for AString
[src]
type Error = ConvertError
The type returned in the event of a conversion error.
pub fn try_from(x: &WString) -> Result<Self, Self::Error>
[src]
impl<'_> TryFrom<&'_ str> for AString
[src]
type Error = ConvertError
The type returned in the event of a conversion error.
pub fn try_from(x: &str) -> Result<Self, Self::Error>
[src]
impl TryFrom<AString> for WString
[src]
type Error = ConvertError
The type returned in the event of a conversion error.
pub fn try_from(x: AString) -> Result<Self, Self::Error>
[src]
impl TryFrom<String> for AString
[src]
type Error = ConvertError
The type returned in the event of a conversion error.
pub fn try_from(x: String) -> Result<Self, Self::Error>
[src]
impl TryFrom<WString> for AString
[src]
type Error = ConvertError
The type returned in the event of a conversion error.
pub fn try_from(x: WString) -> Result<Self, Self::Error>
[src]
impl TryInto<String> for AString
[src]
Auto Trait Implementations
impl RefUnwindSafe for AString
[src]
impl Send for AString
[src]
impl Sync for AString
[src]
impl Unpin for AString
[src]
impl UnwindSafe for AString
[src]
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,
pub 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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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.
pub 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>,