pub enum FsPath {
Str(PyStrRef),
Bytes(PyBytesRef),
}Expand description
Helper to implement os.fspath()
Variants§
Str(PyStrRef)
Bytes(PyBytesRef)
Implementations§
Source§impl FsPath
impl FsPath
pub fn try_from_path_like( obj: PyObjectRef, check_for_nul: bool, vm: &VirtualMachine, ) -> PyResult<Self>
pub fn try_from( obj: PyObjectRef, check_for_nul: bool, msg: &'static str, vm: &VirtualMachine, ) -> PyResult<Self>
pub fn as_os_str(&self, vm: &VirtualMachine) -> PyResult<Cow<'_, OsStr>>
pub fn as_bytes(&self) -> &[u8] ⓘ
pub fn to_string_lossy(&self) -> Cow<'_, str>
pub fn to_path_buf(&self, vm: &VirtualMachine) -> PyResult<PathBuf>
pub fn to_cstring(&self, vm: &VirtualMachine) -> PyResult<CString>
pub fn bytes_as_os_str<'a>( b: &'a [u8], vm: &VirtualMachine, ) -> PyResult<&'a OsStr>
Trait Implementations§
Source§impl ToPyObject for FsPath
impl ToPyObject for FsPath
fn to_pyobject(self, _vm: &VirtualMachine) -> PyObjectRef
Source§impl TryFromObject for FsPath
impl TryFromObject for FsPath
Source§fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self>
fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self>
Attempt to convert a Python object to a value of this type.
Auto Trait Implementations§
impl Freeze for FsPath
impl !RefUnwindSafe for FsPath
impl !Send for FsPath
impl !Sync for FsPath
impl Unpin for FsPath
impl UnsafeUnpin for FsPath
impl !UnwindSafe for FsPath
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromArgOptional for Twhere
T: TryFromObject,
impl<T> FromArgOptional for Twhere
T: TryFromObject,
Source§impl<T> FromArgs for Twhere
T: TryFromObject,
impl<T> FromArgs for Twhere
T: TryFromObject,
Source§fn arity() -> RangeInclusive<usize>
fn arity() -> RangeInclusive<usize>
The range of positional arguments permitted by the function signature. Read more
Source§fn from_args(
vm: &VirtualMachine,
args: &mut FuncArgs,
) -> Result<T, ArgumentError>
fn from_args( vm: &VirtualMachine, args: &mut FuncArgs, ) -> Result<T, ArgumentError>
Extracts this item from the next argument(s).
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more