pub struct ArgBytesLike(/* private fields */);Expand description
any bytes-like object. Like the y* format code for PyArg_Parse in CPython.
Implementations§
Source§impl ArgBytesLike
impl ArgBytesLike
pub fn borrow_buf(&self) -> BorrowedValue<'_, [u8]>
pub fn with_ref<F, R>(&self, f: F) -> R
Sourcepub fn borrow_buf_unlocked(
&self,
vm: &VirtualMachine,
) -> PyResult<UnlockedBuf<'_>>
pub fn borrow_buf_unlocked( &self, vm: &VirtualMachine, ) -> PyResult<UnlockedBuf<'_>>
The bytes to hand to an operation that may wait, and whatever keeps them readable while it does.
borrow_buf may answer with a lock that every other thread writing to
the same object waits on, and a thread waiting on a lock never reaches
a safepoint, so keeping one across a wait for a peer, a pipe or a
signal stops the world from being stopped at all. Bytes reached that
way are copied out first. Bytes that lock nothing – an immutable
object’s – are borrowed where they lie, which is all CPython holds in
either case.
pub const fn len(&self) -> usize
Sourcepub const fn itemsize(&self) -> usize
pub const fn itemsize(&self) -> usize
The width of one item. Callers that read the buffer as bytes rather than as whatever it holds have to ask, since a contiguous buffer of wider items is contiguous all the same.
pub const fn is_empty(&self) -> bool
pub fn as_object(&self) -> &PyObject
Sourcepub fn source_object(&self) -> &PyObject
pub fn source_object(&self) -> &PyObject
The object whose storage is borrowed while this buffer is read: a view borrows the object it looks at, not itself.
Trait Implementations§
Source§impl Debug for ArgBytesLike
impl Debug for ArgBytesLike
Source§impl From<ArgBytesLike> for PyBuffer
impl From<ArgBytesLike> for PyBuffer
Source§fn from(buffer: ArgBytesLike) -> Self
fn from(buffer: ArgBytesLike) -> Self
Source§impl From<ArgBytesLike> for PyObjectRef
impl From<ArgBytesLike> for PyObjectRef
Source§fn from(buffer: ArgBytesLike) -> Self
fn from(buffer: ArgBytesLike) -> Self
Source§impl Traverse for ArgBytesLike
impl Traverse for ArgBytesLike
Source§fn traverse(&self, tracer_fn: &mut TraverseFn<'_>)
fn traverse(&self, tracer_fn: &mut TraverseFn<'_>)
traverse() with caution! Following those guideline so traverse doesn’t cause memory error!: Read moreSource§fn clear(&mut self, _out: &mut Vec<PyObjectRef>)
fn clear(&mut self, _out: &mut Vec<PyObjectRef>)
Source§impl<'a> TryFromBorrowedObject<'a> for ArgBytesLike
impl<'a> TryFromBorrowedObject<'a> for ArgBytesLike
Source§fn try_from_borrowed_object(
vm: &VirtualMachine,
obj: &'a PyObject,
) -> PyResult<Self>
fn try_from_borrowed_object( vm: &VirtualMachine, obj: &'a PyObject, ) -> PyResult<Self>
Auto Trait Implementations§
impl !Freeze for ArgBytesLike
impl !RefUnwindSafe for ArgBytesLike
impl !Send for ArgBytesLike
impl !Sync for ArgBytesLike
impl !UnwindSafe for ArgBytesLike
impl Unpin for ArgBytesLike
impl UnsafeUnpin for ArgBytesLike
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
Source§fn from_args(
vm: &VirtualMachine,
args: &mut FuncArgs,
) -> Result<T, ArgumentError>
fn from_args( vm: &VirtualMachine, args: &mut FuncArgs, ) -> Result<T, ArgumentError>
impl<T> Helper for T
Source§impl<T, U> ImaginaryInto<U> for Twhere
U: ImaginaryFrom<T>,
impl<T, U> ImaginaryInto<U> for Twhere
U: ImaginaryFrom<T>,
fn imaginary_into(self) -> U
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> ⓘ
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> ⓘ
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