[][src]Struct windy::AString

#[repr(C)]pub struct AString { /* fields omitted */ }

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]

Converts ptr string to AString.

Safety

ptr must be a null-terminated ANSI string.

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]

Converts ptr string to AString.

Safety

ptr must be a null-terminated ANSI string.

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]

Converts AStr to WString.

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]

Converts AStr to WString.

Example

use windy::{AString, WString};
let s = WString::from_str("test").unwrap();
let s2 = AString::from_str("test").unwrap().to_wstring_lossy();
assert_eq!(s, s2);

Trait Implementations

impl Clone for AString[src]

impl Debug for AString[src]

impl Deref for AString[src]

type Target = AStr

The resulting type after dereferencing.

impl Drop for AString[src]

impl Eq for AString[src]

impl Hash for AString[src]

impl Index<RangeFull> for AString[src]

type Output = AStr

The returned type after indexing.

impl Ord for AString[src]

impl PartialEq<AString> for AString[src]

impl PartialOrd<AString> for AString[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.

impl<'_> TryFrom<&'_ String> for AString[src]

type Error = ConvertError

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ WStr> for AString[src]

type Error = ConvertError

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ WString> for AString[src]

type Error = ConvertError

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ str> for AString[src]

type Error = ConvertError

The type returned in the event of a conversion error.

impl TryFrom<AString> for WString[src]

type Error = ConvertError

The type returned in the event of a conversion error.

impl TryFrom<String> for AString[src]

type Error = ConvertError

The type returned in the event of a conversion error.

impl TryFrom<WString> for AString[src]

type Error = ConvertError

The type returned in the event of a conversion error.

impl TryInto<String> for AString[src]

type Error = ConvertError

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.