pub struct AnchoredPath { /* private fields */ }Expand description
A path as given, and the path to hand to Win32 for it.
The two are the same unless the path was grafted, by the rules in this module’s documentation. It is
what OpenFile and WatchDirectory hold, and is public
for a crate that builds a request of its own and performs it later on another thread, so that it
fixes the meaning of a relative path by the same contract and does not keep a second one (D-30).
§Example
use windows_namespace_request_sys::AnchoredPath;
use wtf_string::Wtf16String;
// An absolute path is handed to Win32 as it was given.
let absolute = AnchoredPath::new(Wtf16String::from(r"C:\Windows"))?;
assert_eq!(absolute.given(), absolute.win32());
// A relative name is grafted onto the current directory as it is now.
let relative = AnchoredPath::new(Wtf16String::from("a-child"))?;
assert_eq!(relative.given().to_string_lossy(), "a-child");
let expected = std::env::current_dir()?.join("a-child");
assert_eq!(relative.win32().to_string_lossy(), expected.to_string_lossy());Implementations§
Source§impl AnchoredPath
impl AnchoredPath
Sourcepub fn new(given: Wtf16String) -> Result<Self, PathCaptureError>
pub fn new(given: Wtf16String) -> Result<Self, PathCaptureError>
Anchors given to the process current directory as it is now.
§Errors
PathCaptureError::InteriorNul for a path with a NUL before its end, and otherwise the
failure of GetCurrentDirectoryW, which is called only for a path whose shape permits a
graft.
Trait Implementations§
Source§impl Clone for AnchoredPath
impl Clone for AnchoredPath
Source§impl Debug for AnchoredPath
impl Debug for AnchoredPath
impl Eq for AnchoredPath
Source§impl Hash for AnchoredPath
impl Hash for AnchoredPath
Source§impl PartialEq for AnchoredPath
impl PartialEq for AnchoredPath
impl StructuralPartialEq for AnchoredPath
Auto Trait Implementations§
impl Freeze for AnchoredPath
impl RefUnwindSafe for AnchoredPath
impl Send for AnchoredPath
impl Sync for AnchoredPath
impl Unpin for AnchoredPath
impl UnsafeUnpin for AnchoredPath
impl UnwindSafe for AnchoredPath
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