pub struct AString { /* private fields */ }Expand description
ANSI string
Implementations§
Source§impl AString
impl AString
pub fn as_bytes_with_nul(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_c_str(&self) -> &AStr
pub fn as_mut_c_str(&mut self) -> &mut AStr
pub fn as_ptr(&self) -> *const u8
pub fn len(&self) -> usize
pub fn to_string(&self) -> OsResult<String>
pub fn to_string_lossy(&self) -> String
pub fn new(v: Vec<u8>) -> Self
Sourcepub unsafe fn from_str_unchecked(s: &str) -> Self
pub unsafe fn from_str_unchecked(s: &str) -> Self
Converts &str to AString without an encoding check.
§Example
use winapi::shared::minwindef::FARPROC;
use winwrap::OsResult;
use winwrap::string::*;
use winwrap::um::libloaderapi::{get_proc_address, load_library_w, ProcAddress};
/// It is assumed that a function name does not contains any multi-byte character.
pub unsafe fn load_and_get_proc_address(dll_name: &str, func_name: &str) -> OsResult<FARPROC> {
let m = load_library_w(&WString::from(dll_name))?;
get_proc_address(&m, ProcAddress::ByName(&AString::from_str_unchecked(func_name)))
}Sourcepub fn new_nul_unchecked(v: Vec<u8>) -> Self
pub fn new_nul_unchecked(v: Vec<u8>) -> Self
§Safety
v must be a null-terminated ANSI string.
Sourcepub unsafe fn from_raw(ptr: *mut u8) -> Self
pub unsafe fn from_raw(ptr: *mut u8) -> Self
§Safety
ptr must be a null-terminated ANSI string.
pub unsafe fn from_raw_s(ptr: *mut u8, len: usize) -> Self
Trait Implementations§
Source§impl Ord for AString
impl Ord for AString
Source§impl PartialOrd for AString
impl PartialOrd for AString
impl Eq for AString
impl StructuralPartialEq for AString
Auto Trait Implementations§
impl Freeze for AString
impl RefUnwindSafe for AString
impl Send for AString
impl Sync for AString
impl Unpin for AString
impl UnsafeUnpin for AString
impl UnwindSafe for AString
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