pub type Drain<'a, K, V> = DynTrait<'a, RBox<()>, ValIterInterface<K, V>>;
Expand description
An RHashMap iterator,
implementing Iterator<Item= Tuple2< K, V > > + !Send + !Sync
Aliased Type§
struct Drain<'a, K, V> { /* private fields */ }
Implementations
Source§impl<'borr, P, I> DynTrait<'borr, P, I>where
P: GetPointerKind,
impl<'borr, P, I> DynTrait<'borr, P, I>where
P: GetPointerKind,
Sourcepub fn from_borrowing_ptr<OrigPtr>(object: OrigPtr) -> Selfwhere
OrigPtr: GetPointerKind + 'borr + CanTransmuteElement<(), TransmutedPtr = P>,
OrigPtr::PtrTarget: 'borr,
VTable_Ref<'borr, P, I>: MakeVTable<'borr, OrigPtr::PtrTarget, OrigPtr, TD_Opaque>,
pub fn from_borrowing_ptr<OrigPtr>(object: OrigPtr) -> Selfwhere
OrigPtr: GetPointerKind + 'borr + CanTransmuteElement<(), TransmutedPtr = P>,
OrigPtr::PtrTarget: 'borr,
VTable_Ref<'borr, P, I>: MakeVTable<'borr, OrigPtr::PtrTarget, OrigPtr, TD_Opaque>,
Constructs the DynTrait<_>
from a pointer to the erased type
with a 'borr
borrow.
Cannot downcast the DynTrait afterwards.
§Example
use abi_stable::{
erased_types::interfaces::DebugDisplayInterface,
std_types::{RArc, RBox},
DynTrait, RMut, RRef,
};
// Constructing a DynTrait from a `&T`
{
// `DynTrait`s constructed from `&` are `DynTrait<'_, RRef<'_, ()>, _>`
// since `&T` can't soundly be transmuted back and forth into `&()`
let rref: DynTrait<'_, RRef<'_, ()>, DebugDisplayInterface> =
DynTrait::from_borrowing_ptr(&34i32);
assert_eq!(format!("{:?}", rref), "34");
assert_eq!(format!("{}", rref), "34");
}
// Constructing a DynTrait from a `&mut T`
{
let mmut = &mut "world";
// `DynTrait`s constructed from `&mut` are `DynTrait<'_, RMut<'_, ()>, _>`
// since `&mut T` can't soundly be transmuted back and forth into `&mut ()`
let rmut: DynTrait<'_, RMut<'_, ()>, DebugDisplayInterface> =
DynTrait::from_borrowing_ptr(mmut).interface(DebugDisplayInterface);
assert_eq!(format!("{:?}", rmut), r#""world""#);
assert_eq!(format!("{}", rmut), "world");
}
// Constructing a DynTrait from a `RBox<T>`
{
let boxed: DynTrait<'_, RBox<()>, DebugDisplayInterface> =
DynTrait::from_borrowing_ptr(RBox::new(true));
assert_eq!(format!("{:?}", boxed), "true");
assert_eq!(format!("{}", boxed), "true");
}
// Constructing a DynTrait from an `RArc<T>`
{
let arc: DynTrait<'_, RArc<()>, _> =
DynTrait::from_borrowing_ptr(RArc::new('a')).interface(DebugDisplayInterface);
assert_eq!(format!("{:?}", arc), "'a'");
assert_eq!(format!("{}", arc), "a");
}
Source§impl<'borr, P, I, EV> DynTrait<'borr, P, I, EV>where
P: GetPointerKind,
impl<'borr, P, I, EV> DynTrait<'borr, P, I, EV>where
P: GetPointerKind,
Sourcepub fn downcast_into<T>(self) -> Result<P::TransmutedPtr, UneraseError<Self>>where
T: 'static,
P: CanTransmuteElement<T>,
pub fn downcast_into<T>(self) -> Result<P::TransmutedPtr, UneraseError<Self>>where
T: 'static,
P: CanTransmuteElement<T>,
Unwraps the DynTrait<_>
into a pointer of
the concrete type that it was constructed with.
T
is required to not borrow anything.
§Errors
This will return an error in any of these conditions:
-
It is called in a dynamic library/binary outside the one from which this
DynTrait<_>
was constructed. -
The DynTrait was constructed using a
from_borrowing_*
method -
T
is not the concrete type thisDynTrait<_>
was constructed with.
§Example
use abi_stable::{
std_types::{RArc, RBox},
DynTrait,
};
{
fn to() -> DynTrait<'static, RBox<()>, ()> {
DynTrait::from_value(b'A')
}
assert_eq!(to().downcast_into::<u8>().ok(), Some(RBox::new(b'A')));
assert_eq!(to().downcast_into::<u16>().ok(), None);
}
{
fn to() -> DynTrait<'static, RArc<()>, ()> {
DynTrait::from_ptr(RArc::new(b'B'))
}
assert_eq!(to().downcast_into::<u8>().ok(), Some(RArc::new(b'B')));
assert_eq!(to().downcast_into::<u16>().ok(), None);
}
Sourcepub fn downcast_as<T>(&self) -> Result<&T, UneraseError<&Self>>where
T: 'static,
P: AsPtr,
pub fn downcast_as<T>(&self) -> Result<&T, UneraseError<&Self>>where
T: 'static,
P: AsPtr,
Unwraps the DynTrait<_>
into a reference of
the concrete type that it was constructed with.
T
is required to not borrow anything.
§Errors
This will return an error in any of these conditions:
-
It is called in a dynamic library/binary outside the one from which this
DynTrait<_>
was constructed. -
The DynTrait was constructed using a
from_borrowing_*
method -
T
is not the concrete type thisDynTrait<_>
was constructed with.
§Example
use abi_stable::{std_types::RArc, DynTrait, RMut, RRef};
{
let to: DynTrait<'static, RRef<'_, ()>, ()> = DynTrait::from_ptr(&9u8);
assert_eq!(to.downcast_as::<u8>().ok(), Some(&9u8));
assert_eq!(to.downcast_as::<u16>().ok(), None);
}
{
let mut val = 7u8;
let to: DynTrait<'static, RMut<'_, ()>, ()> =
DynTrait::from_ptr(&mut val);
assert_eq!(to.downcast_as::<u8>().ok(), Some(&7));
assert_eq!(to.downcast_as::<u16>().ok(), None);
}
{
let to: DynTrait<'static, RArc<()>, ()> =
DynTrait::from_ptr(RArc::new(1u8));
assert_eq!(to.downcast_as::<u8>().ok(), Some(&1u8));
assert_eq!(to.downcast_as::<u16>().ok(), None);
}
Sourcepub fn downcast_as_mut<T>(&mut self) -> Result<&mut T, UneraseError<&mut Self>>where
T: 'static,
P: AsMutPtr,
pub fn downcast_as_mut<T>(&mut self) -> Result<&mut T, UneraseError<&mut Self>>where
T: 'static,
P: AsMutPtr,
Unwraps the DynTrait<_>
into a mutable reference of
the concrete type that it was constructed with.
T
is required to not borrow anything.
§Errors
This will return an error in any of these conditions:
-
It is called in a dynamic library/binary outside the one from which this
DynTrait<_>
was constructed. -
The DynTrait was constructed using a
from_borrowing_*
method -
T
is not the concrete type thisDynTrait<_>
was constructed with.
§Example
use abi_stable::{std_types::RBox, DynTrait, RMut};
{
let mut val = 7u8;
let mut to: DynTrait<'static, RMut<'_, ()>, ()> =
DynTrait::from_ptr(&mut val);
assert_eq!(to.downcast_as_mut::<u8>().ok(), Some(&mut 7));
assert_eq!(to.downcast_as_mut::<u16>().ok(), None);
}
{
let mut to: DynTrait<'static, RBox<()>, ()> =
DynTrait::from_ptr(RBox::new(1u8));
assert_eq!(to.downcast_as_mut::<u8>().ok(), Some(&mut 1u8));
assert_eq!(to.downcast_as_mut::<u16>().ok(), None);
}
Sourcepub unsafe fn unchecked_downcast_into<T>(self) -> P::TransmutedPtrwhere
P: AsPtr + CanTransmuteElement<T>,
pub unsafe fn unchecked_downcast_into<T>(self) -> P::TransmutedPtrwhere
P: AsPtr + CanTransmuteElement<T>,
Unwraps the DynTrait<_>
into a pointer to T,
without checking whether T
is the type that the DynTrait was constructed with.
§Safety
You must check that T
is the type that DynTrait was constructed
with through other means.
§Example
use abi_stable::{
std_types::{RArc, RBox},
DynTrait,
};
unsafe {
fn to() -> DynTrait<'static, RBox<()>, ()> {
DynTrait::from_value(b'A')
}
assert_eq!(to().unchecked_downcast_into::<u8>(), RBox::new(b'A'));
}
unsafe {
fn to() -> DynTrait<'static, RArc<()>, ()> {
DynTrait::from_ptr(RArc::new(b'B'))
}
assert_eq!(to().unchecked_downcast_into::<u8>(), RArc::new(b'B'));
}
Sourcepub unsafe fn unchecked_downcast_as<T>(&self) -> &Twhere
P: AsPtr,
pub unsafe fn unchecked_downcast_as<T>(&self) -> &Twhere
P: AsPtr,
Unwraps the DynTrait<_>
into a reference to T,
without checking whether T
is the type that the DynTrait was constructed with.
§Safety
You must check that T
is the type that DynTrait was constructed
with through other means.
§Example
use abi_stable::{std_types::RArc, DynTrait, RMut, RRef};
unsafe {
let to: DynTrait<'static, RRef<'_, ()>, ()> = DynTrait::from_ptr(&9u8);
assert_eq!(to.unchecked_downcast_as::<u8>(), &9u8);
}
unsafe {
let mut val = 7u8;
let to: DynTrait<'static, RMut<'_, ()>, ()> =
DynTrait::from_ptr(&mut val);
assert_eq!(to.unchecked_downcast_as::<u8>(), &7);
}
unsafe {
let to: DynTrait<'static, RArc<()>, ()> =
DynTrait::from_ptr(RArc::new(1u8));
assert_eq!(to.unchecked_downcast_as::<u8>(), &1u8);
}
Sourcepub unsafe fn unchecked_downcast_as_mut<T>(&mut self) -> &mut Twhere
P: AsMutPtr,
pub unsafe fn unchecked_downcast_as_mut<T>(&mut self) -> &mut Twhere
P: AsMutPtr,
Unwraps the DynTrait<_>
into a mutable reference to T,
without checking whether T
is the type that the DynTrait was constructed with.
§Safety
You must check that T
is the type that DynTrait was constructed
with through other means.
§Example
use abi_stable::{std_types::RBox, DynTrait, RMut};
unsafe {
let mut val = 7u8;
let mut to: DynTrait<'static, RMut<'_, ()>, ()> =
DynTrait::from_ptr(&mut val);
assert_eq!(to.unchecked_downcast_as_mut::<u8>(), &mut 7);
}
unsafe {
let mut to: DynTrait<'static, RBox<()>, ()> =
DynTrait::from_ptr(RBox::new(1u8));
assert_eq!(to.unchecked_downcast_as_mut::<u8>(), &mut 1u8);
}
Source§impl<'borr, P, I, EV> DynTrait<'borr, P, I, EV>where
P: GetPointerKind,
I: InterfaceType,
impl<'borr, P, I, EV> DynTrait<'borr, P, I, EV>where
P: GetPointerKind,
I: InterfaceType,
Sourcepub fn reborrow<'re>(&'re self) -> DynTrait<'borr, RRef<'re, ()>, I, EV> ⓘ
pub fn reborrow<'re>(&'re self) -> DynTrait<'borr, RRef<'re, ()>, I, EV> ⓘ
Creates a shared reborrow of this DynTrait.
The reborrowed DynTrait cannot use these methods:
- DynTrait::default
This is only callable if DynTrait
is either Send + Sync
or !Send + !Sync
.
§Example
use abi_stable::{
erased_types::interfaces::DebugDisplayInterface,
std_types::RBox,
type_level::{impl_enum::Implemented, trait_marker},
DynTrait, InterfaceType, RRef,
};
let to: DynTrait<'static, RBox<()>, DebugDisplayInterface> =
DynTrait::from_value(1337_u16);
assert_eq!(debug_string(to.reborrow()), "1337");
fn debug_string<I>(to: DynTrait<'_, RRef<'_, ()>, I>) -> String
where
I: InterfaceType<Debug = Implemented<trait_marker::Debug>>,
{
format!("{:?}", to)
}
Sourcepub fn reborrow_mut<'re>(&'re mut self) -> DynTrait<'borr, RMut<'re, ()>, I, EV> ⓘ
pub fn reborrow_mut<'re>(&'re mut self) -> DynTrait<'borr, RMut<'re, ()>, I, EV> ⓘ
Creates a mutable reborrow of this DynTrait.
The reborrowed DynTrait cannot use these methods:
-
DynTrait::default
-
DynTrait::clone
This is only callable if DynTrait
is either Send + Sync
or !Send + !Sync
.
§Example
use abi_stable::{
erased_types::interfaces::DEIteratorInterface, std_types::RBox, DynTrait,
};
let mut to = DynTrait::from_value(0_u8..=255).interface(DEIteratorInterface::NEW);
assert_eq!(both_ends(to.reborrow_mut()), (Some(0), Some(255)));
assert_eq!(both_ends(to.reborrow_mut()), (Some(1), Some(254)));
assert_eq!(both_ends(to.reborrow_mut()), (Some(2), Some(253)));
assert_eq!(both_ends(to.reborrow_mut()), (Some(3), Some(252)));
fn both_ends<I>(mut to: I) -> (Option<I::Item>, Option<I::Item>)
where
I: DoubleEndedIterator,
{
(to.next(), to.next_back())
}
Source§impl<'borr, P, I, EV> DynTrait<'borr, P, I, EV>where
I: InterfaceType + 'borr,
EV: 'borr,
P: AsPtr,
impl<'borr, P, I, EV> DynTrait<'borr, P, I, EV>where
I: InterfaceType + 'borr,
EV: 'borr,
P: AsPtr,
Sourcepub fn default(&self) -> Selfwhere
P: AsPtr + GetPointerKind<Kind = PK_SmartPointer>,
I: InterfaceType<Default = Implemented<Default>>,
EV: Copy,
pub fn default(&self) -> Selfwhere
P: AsPtr + GetPointerKind<Kind = PK_SmartPointer>,
I: InterfaceType<Default = Implemented<Default>>,
EV: Copy,
Constructs a DynTrait<P, I>
with the default value for P
.
§Reborrowing
This cannot be called with a reborrowed DynTrait:
let object = DynTrait::from_value(()).interface(DefaultInterface);
let borrow = object.reborrow();
let _ = borrow.default();
let object = DynTrait::from_value(()).interface(DefaultInterface);
let borrow = object.reborrow_mut();
let _ = borrow.default();
§Example
use abi_stable::{erased_types::interfaces::DebugDefEqInterface, DynTrait};
{
let object = DynTrait::from_value(true).interface(DebugDefEqInterface);
assert_eq!(
object.default(),
DynTrait::from_value(false).interface(DebugDefEqInterface)
);
}
{
let object = DynTrait::from_value(123u8).interface(DebugDefEqInterface);
assert_eq!(
object.default(),
DynTrait::from_value(0u8).interface(DebugDefEqInterface)
);
}
Sourcepub fn serialize_into_proxy<'a>(&'a self) -> Result<I::ProxyType, RBoxError>
pub fn serialize_into_proxy<'a>(&'a self) -> Result<I::ProxyType, RBoxError>
It serializes a DynTrait<_>
into a string by using
<ConcreteType as SerializeType>::serialize_impl
.
Sourcepub fn deserialize_from_proxy<'de>(proxy: I::Proxy) -> Result<Self, RBoxError>where
P: 'borr + AsPtr,
I: DeserializeDyn<'de, Self>,
pub fn deserialize_from_proxy<'de>(proxy: I::Proxy) -> Result<Self, RBoxError>where
P: 'borr + AsPtr,
I: DeserializeDyn<'de, Self>,
Deserializes a DynTrait<'borr, _>
from a proxy type, by using
<I as DeserializeDyn<'borr, Self>>::deserialize_dyn
.
Source§impl<'borr, P, I, Item, EV> DynTrait<'borr, P, I, EV>where
P: AsMutPtr,
I: IteratorItemOrDefault<'borr, Item = Item> + InterfaceType<Iterator = Implemented<Iterator>>,
Item: 'borr,
impl<'borr, P, I, Item, EV> DynTrait<'borr, P, I, EV>where
P: AsMutPtr,
I: IteratorItemOrDefault<'borr, Item = Item> + InterfaceType<Iterator = Implemented<Iterator>>,
Item: 'borr,
Sourcepub fn skip_eager(&mut self, n: usize)
pub fn skip_eager(&mut self, n: usize)
Eagerly skips n elements from the iterator.
This method is faster than using Iterator::skip
.
§Example
let mut iter = 0..20;
let mut wrapped = DynTrait::from_ptr(&mut iter).interface(IteratorInterface::NEW);
assert_eq!(wrapped.next(), Some(0));
wrapped.skip_eager(2);
assert_eq!(wrapped.next(), Some(3));
assert_eq!(wrapped.next(), Some(4));
assert_eq!(wrapped.next(), Some(5));
wrapped.skip_eager(2);
assert_eq!(wrapped.next(), Some(8));
assert_eq!(wrapped.next(), Some(9));
wrapped.skip_eager(9);
assert_eq!(wrapped.next(), Some(19));
assert_eq!(wrapped.next(), None);
Sourcepub fn extending_rvec(
&mut self,
buffer: &mut RVec<Item>,
taking: ROption<usize>,
)
pub fn extending_rvec( &mut self, buffer: &mut RVec<Item>, taking: ROption<usize>, )
Extends the RVec<Item>
with the self
Iterator.
Extends buffer
with as many elements of the iterator as taking
specifies:
-
RNone: Yields all elements.Use this with care, since Iterators can be infinite.
-
RSome(n): Yields n elements.
§Example
let mut wrapped = DynTrait::from_value(0..).interface(IteratorInterface::NEW);
let mut buffer = vec![101, 102, 103].into_c();
wrapped.extending_rvec(&mut buffer, RSome(5));
assert_eq!(&buffer[..], &*vec![101, 102, 103, 0, 1, 2, 3, 4]);
assert_eq!(wrapped.next(), Some(5));
assert_eq!(wrapped.next(), Some(6));
assert_eq!(wrapped.next(), Some(7));
Source§impl<'borr, P, I, Item, EV> DynTrait<'borr, P, I, EV>where
Self: Iterator<Item = Item>,
P: AsMutPtr,
I: IteratorItemOrDefault<'borr, Item = Item> + InterfaceType<DoubleEndedIterator = Implemented<DoubleEndedIterator>>,
Item: 'borr,
impl<'borr, P, I, Item, EV> DynTrait<'borr, P, I, EV>where
Self: Iterator<Item = Item>,
P: AsMutPtr,
I: IteratorItemOrDefault<'borr, Item = Item> + InterfaceType<DoubleEndedIterator = Implemented<DoubleEndedIterator>>,
Item: 'borr,
Sourcepub fn nth_back_(&mut self, nth: usize) -> Option<Item>
pub fn nth_back_(&mut self, nth: usize) -> Option<Item>
Gets teh nth
element from the back of the iterator.
§Example
use abi_stable::{erased_types::interfaces::DEIteratorCloneInterface, DynTrait};
let to = || DynTrait::from_value(7..=10).interface(DEIteratorCloneInterface::NEW);
assert_eq!(to().nth_back_(0), Some(10));
assert_eq!(to().nth_back_(1), Some(9));
assert_eq!(to().nth_back_(2), Some(8));
assert_eq!(to().nth_back_(3), Some(7));
assert_eq!(to().nth_back_(4), None);
assert_eq!(to().nth_back_(5), None);
Sourcepub fn extending_rvec_back(
&mut self,
buffer: &mut RVec<Item>,
taking: ROption<usize>,
)
pub fn extending_rvec_back( &mut self, buffer: &mut RVec<Item>, taking: ROption<usize>, )
Extends the RVec<Item>
with the back of the self
DoubleEndedIterator.
Extends buffer
with as many elements of the iterator as taking
specifies:
-
RNone: Yields all elements.Use this with care, since Iterators can be infinite.
-
RSome(n): Yields n elements.
§Example
let mut wrapped = DynTrait::from_value(0..=3).interface(DEIteratorInterface::NEW);
let mut buffer = vec![101, 102, 103].into_c();
wrapped.extending_rvec_back(&mut buffer, RNone);
assert_eq!(&buffer[..], &*vec![101, 102, 103, 3, 2, 1, 0])
Source§impl<'borr, P, I, EV> DynTrait<'borr, P, I, EV>
impl<'borr, P, I, EV> DynTrait<'borr, P, I, EV>
Sourcepub fn with_extra_value<OrigPtr, Downcasting>(
ptr: OrigPtr,
extra_value: EV,
) -> DynTrait<'borr, P, I, EV> ⓘwhere
OrigPtr: GetPointerKind + CanTransmuteElement<(), TransmutedPtr = P>,
OrigPtr::PtrTarget: 'borr,
VTable_Ref<'borr, P, I>: MakeVTable<'borr, OrigPtr::PtrTarget, OrigPtr, Downcasting>,
pub fn with_extra_value<OrigPtr, Downcasting>(
ptr: OrigPtr,
extra_value: EV,
) -> DynTrait<'borr, P, I, EV> ⓘwhere
OrigPtr: GetPointerKind + CanTransmuteElement<(), TransmutedPtr = P>,
OrigPtr::PtrTarget: 'borr,
VTable_Ref<'borr, P, I>: MakeVTable<'borr, OrigPtr::PtrTarget, OrigPtr, Downcasting>,
Constructs an DynTrait from an erasable pointer and an extra value.
§Example
use abi_stable::{
erased_types::{interfaces::DebugDisplayInterface, TD_Opaque},
DynTrait, RRef,
};
// DebugDisplayInterface is `Debug + Display + Sync + Send`
let to: DynTrait<'static, RRef<()>, DebugDisplayInterface, usize> =
DynTrait::with_extra_value::<_, TD_Opaque>(&55u8, 100usize);
assert_eq!(format!("{}", to), "55");
assert_eq!(format!("{:?}", to), "55");
assert_eq!(to.sabi_extra_value(), &100);
Source§impl<'borr, P, I, EV> DynTrait<'borr, P, I, EV>where
P: GetPointerKind,
impl<'borr, P, I, EV> DynTrait<'borr, P, I, EV>where
P: GetPointerKind,
Sourcepub const fn interface(self, _interface: I) -> Selfwhere
I: InterfaceType,
pub const fn interface(self, _interface: I) -> Selfwhere
I: InterfaceType,
For inferring the I
type parameter.
Source§impl<'borr, P, I, EV> DynTrait<'borr, P, I, EV>where
P: GetPointerKind,
impl<'borr, P, I, EV> DynTrait<'borr, P, I, EV>where
P: GetPointerKind,
Sourcepub const fn sabi_extra_value(&self) -> &EV
pub const fn sabi_extra_value(&self) -> &EV
Gets access to the extra value that was stored in this DynTrait in the
with_extra_value
constructor.
§Example
use abi_stable::{erased_types::TD_Opaque, DynTrait, RRef};
let to: DynTrait<'static, RRef<()>, (), char> =
DynTrait::with_extra_value::<_, TD_Opaque>(&55u8, 'Z');
assert_eq!(to.sabi_extra_value(), &'Z');
Sourcepub fn sabi_object_address(&self) -> usizewhere
P: AsPtr,
pub fn sabi_object_address(&self) -> usizewhere
P: AsPtr,
Returns the address of the wrapped object.
§Example
use abi_stable::{erased_types::TD_Opaque, DynTrait, RRef};
let reff = &55u8;
let to: DynTrait<'static, RRef<()>, ()> = DynTrait::from_ptr(reff);
assert_eq!(to.sabi_object_address(), reff as *const _ as usize);
Sourcepub fn sabi_erased_ref(&self) -> RRef<'_, ErasedObject>where
P: AsPtr,
pub fn sabi_erased_ref(&self) -> RRef<'_, ErasedObject>where
P: AsPtr,
Gets a reference pointing to the erased object.
§Example
use abi_stable::{std_types::RBox, DynTrait};
let to: DynTrait<'static, RBox<()>, ()> = DynTrait::from_value(66u8);
unsafe {
assert_eq!(to.sabi_erased_ref().transmute_into_ref::<u8>(), &66);
}
Sourcepub fn sabi_erased_mut(&mut self) -> RMut<'_, ErasedObject>where
P: AsMutPtr,
pub fn sabi_erased_mut(&mut self) -> RMut<'_, ErasedObject>where
P: AsMutPtr,
Gets a mutable reference pointing to the erased object.
§Example
use abi_stable::{std_types::RBox, DynTrait};
let mut to: DynTrait<'static, RBox<()>, ()> = DynTrait::from_value("hello");
unsafe {
assert_eq!(
to.sabi_erased_mut().transmute_into_mut::<&str>(),
&mut "hello"
);
}
Sourcepub fn sabi_as_rref(&self) -> RRef<'_, ()>where
P: AsPtr,
pub fn sabi_as_rref(&self) -> RRef<'_, ()>where
P: AsPtr,
Gets an RRef
pointing to the erased object.
§Example
use abi_stable::{std_types::RBox, DynTrait};
let to: DynTrait<'static, RBox<()>, ()> = DynTrait::from_value(66u8);
unsafe {
assert_eq!(to.sabi_as_rref().transmute_into_ref::<u8>(), &66);
}
Sourcepub fn sabi_as_rmut(&mut self) -> RMut<'_, ()>where
P: AsMutPtr,
pub fn sabi_as_rmut(&mut self) -> RMut<'_, ()>where
P: AsMutPtr,
Gets an RMut
pointing to the erased object.
§Example
use abi_stable::{std_types::RBox, DynTrait};
let mut to: DynTrait<'static, RBox<()>, ()> = DynTrait::from_value("hello");
unsafe {
assert_eq!(to.sabi_as_rmut().transmute_into_mut::<&str>(), &mut "hello");
}
Sourcepub fn sabi_with_value<F, R>(self, f: F) -> R
pub fn sabi_with_value<F, R>(self, f: F) -> R
Calls the f
callback with an MovePtr
pointing to the erased object.
§Example
use abi_stable::{
sabi_types::MovePtr,
std_types::{RBox, RString, RVec},
DynTrait,
};
let to: DynTrait<'static, RBox<()>, ()> =
DynTrait::from_value(RString::from("foobarbaz"));
let string = to.sabi_with_value(|x| {
// SAFETY: the erased object is an RString constructed in the current binary.
unsafe {
MovePtr::into_inner(MovePtr::transmute::<RString>(x))
}
});
assert_eq!(string, "foobarbaz");
Source§impl<'borr, I> DynTrait<'borr, RBox<()>, I>
impl<'borr, I> DynTrait<'borr, RBox<()>, I>
Sourcepub fn from_borrowing_value<T>(object: T) -> Self
pub fn from_borrowing_value<T>(object: T) -> Self
Constructs the DynTrait<_>
from a value with a 'borr
borrow.
Cannot downcast the DynTrait afterwards.
§Example
use abi_stable::{
erased_types::interfaces::DebugDisplayInterface, std_types::RBox, DynTrait,
};
// DebugDisplayInterface is `Debug + Display + Sync + Send`
let to: DynTrait<'static, RBox<()>, DebugDisplayInterface> =
DynTrait::from_borrowing_value(3u8);
assert_eq!(format!("{}", to), "3");
assert_eq!(format!("{:?}", to), "3");
// `DynTrait`s constructed using the `from_borrowing_*` constructors
// can't be downcasted.
assert_eq!(to.downcast_as::<u8>().ok(), None);
Source§impl<P, I> DynTrait<'static, P, I>where
P: GetPointerKind,
impl<P, I> DynTrait<'static, P, I>where
P: GetPointerKind,
Sourcepub fn from_ptr<OrigPtr>(object: OrigPtr) -> Selfwhere
OrigPtr: GetPointerKind + CanTransmuteElement<(), TransmutedPtr = P>,
OrigPtr::PtrTarget: 'static,
VTable_Ref<'static, P, I>: MakeVTable<'static, OrigPtr::PtrTarget, OrigPtr, TD_CanDowncast>,
pub fn from_ptr<OrigPtr>(object: OrigPtr) -> Selfwhere
OrigPtr: GetPointerKind + CanTransmuteElement<(), TransmutedPtr = P>,
OrigPtr::PtrTarget: 'static,
VTable_Ref<'static, P, I>: MakeVTable<'static, OrigPtr::PtrTarget, OrigPtr, TD_CanDowncast>,
Constructs the DynTrait<_>
from a pointer to a
type that doesn’t borrow anything.
§Example
use abi_stable::{
erased_types::interfaces::DebugDisplayInterface,
std_types::{RArc, RBox},
DynTrait, RMut, RRef,
};
// Constructing a DynTrait from a `&T`
{
// `DynTrait`s constructed from `&` are `DynTrait<'_, RRef<'_, ()>, _>`
// since `&T` can't soundly be transmuted back and forth into `&()`
let rref: DynTrait<'static, RRef<'_, ()>, DebugDisplayInterface> =
DynTrait::from_ptr(&21i32);
assert_eq!(format!("{:?}", rref), "21");
assert_eq!(format!("{}", rref), "21");
}
// Constructing a DynTrait from a `&mut T`
{
let mmut = &mut "hello";
// `DynTrait`s constructed from `&mut` are `DynTrait<'_, RMut<'_, ()>, _>`
// since `&mut T` can't soundly be transmuted back and forth into `&mut ()`
let rmut: DynTrait<'static, RMut<'_, ()>, DebugDisplayInterface> =
DynTrait::from_ptr(mmut).interface(DebugDisplayInterface);
assert_eq!(format!("{:?}", rmut), r#""hello""#);
assert_eq!(format!("{}", rmut), "hello");
}
// Constructing a DynTrait from a `RBox<T>`
{
let boxed: DynTrait<'static, RBox<()>, DebugDisplayInterface> =
DynTrait::from_ptr(RBox::new(false));
assert_eq!(format!("{:?}", boxed), "false");
assert_eq!(format!("{}", boxed), "false");
}
// Constructing a DynTrait from an `RArc<T>`
{
let arc: DynTrait<'static, RArc<()>, DebugDisplayInterface> =
DynTrait::from_ptr(RArc::new(30u32)).interface(DebugDisplayInterface);
assert_eq!(format!("{:?}", arc), "30");
}
Source§impl<P, I, EV> DynTrait<'static, P, I, EV>where
P: GetPointerKind,
impl<P, I, EV> DynTrait<'static, P, I, EV>where
P: GetPointerKind,
Sourcepub fn sabi_is_same_type<Other, I2, EV2>(
&self,
other: &DynTrait<'static, Other, I2, EV2>,
) -> boolwhere
I2: InterfaceType,
Other: GetPointerKind,
pub fn sabi_is_same_type<Other, I2, EV2>(
&self,
other: &DynTrait<'static, Other, I2, EV2>,
) -> boolwhere
I2: InterfaceType,
Other: GetPointerKind,
Allows checking whether 2 DynTrait<_>
s have a value of the same type.
Notes:
-
Types from different dynamic libraries/executables are never considered equal.
-
DynTrait
s constructed usingDynTrait::from_borrowing_*
are never considered to wrap the same type.
Source§impl<I> DynTrait<'static, RBox<()>, I>
impl<I> DynTrait<'static, RBox<()>, I>
Sourcepub fn from_value<T>(object: T) -> Selfwhere
T: 'static,
VTable_Ref<'static, RBox<()>, I>: MakeVTable<'static, T, RBox<T>, TD_CanDowncast>,
pub fn from_value<T>(object: T) -> Selfwhere
T: 'static,
VTable_Ref<'static, RBox<()>, I>: MakeVTable<'static, T, RBox<T>, TD_CanDowncast>,
Constructs the DynTrait<_>
from a type that doesn’t borrow anything.
§Example
use abi_stable::{
erased_types::interfaces::DebugDisplayInterface, std_types::RBox, DynTrait,
};
// DebugDisplayInterface is `Debug + Display + Sync + Send`
let to: DynTrait<'static, RBox<()>, DebugDisplayInterface> =
DynTrait::from_value(3u8);
assert_eq!(format!("{}", to), "3");
assert_eq!(format!("{:?}", to), "3");
Trait Implementations
Source§impl<'borr, P, I, EV> BufRead for DynTrait<'borr, P, I, EV>where
P: AsMutPtr,
I: InterfaceType<IoRead = Implemented<IoRead>, IoBufRead = Implemented<IoBufRead>>,
impl<'borr, P, I, EV> BufRead for DynTrait<'borr, P, I, EV>where
P: AsMutPtr,
I: InterfaceType<IoRead = Implemented<IoRead>, IoBufRead = Implemented<IoBufRead>>,
Source§fn fill_buf(&mut self) -> Result<&[u8]>
fn fill_buf(&mut self) -> Result<&[u8]>
Source§fn consume(&mut self, amount: usize)
fn consume(&mut self, amount: usize)
amt
bytes have been consumed from the buffer,
so they should no longer be returned in calls to read
. Read moreSource§fn has_data_left(&mut self) -> Result<bool, Error>
fn has_data_left(&mut self) -> Result<bool, Error>
buf_read_has_data_left
)Read
has any data left to be read. Read more1.83.0 · Source§fn skip_until(&mut self, byte: u8) -> Result<usize, Error>
fn skip_until(&mut self, byte: u8) -> Result<usize, Error>
byte
or EOF is reached. Read more1.0.0 · Source§fn read_line(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_line(&mut self, buf: &mut String) -> Result<usize, Error>
0xA
byte) is reached, and append
them to the provided String
buffer. Read moreSource§impl<'borr, P, I, EV> Clone for DynTrait<'borr, P, I, EV>
impl<'borr, P, I, EV> Clone for DynTrait<'borr, P, I, EV>
Clone is implemented for references and smart pointers,
using GetPointerKind
to decide whether P
is a smart pointer or a reference.
DynTrait does not implement Clone if P ==RMut<'_, ()>
:
let mut object = DynTrait::from_value(()).interface(());
let borrow = object.reborrow_mut();
let _ = borrow.clone();
Source§impl<'de, 'borr: 'de, P, I, EV> Deserialize<'de> for DynTrait<'borr, P, I, EV>where
EV: 'borr,
P: AsPtr + 'borr,
I: InterfaceType + 'borr + DeserializeDyn<'de, Self>,
<I as DeserializeDyn<'de, Self>>::Proxy: Deserialize<'de>,
impl<'de, 'borr: 'de, P, I, EV> Deserialize<'de> for DynTrait<'borr, P, I, EV>where
EV: 'borr,
P: AsPtr + 'borr,
I: InterfaceType + 'borr + DeserializeDyn<'de, Self>,
<I as DeserializeDyn<'de, Self>>::Proxy: Deserialize<'de>,
For an example of how to deserialize DynTrait, look here
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl<'borr, P, I, Item, EV> DoubleEndedIterator for DynTrait<'borr, P, I, EV>where
Self: Iterator<Item = Item>,
P: AsMutPtr,
I: IteratorItemOrDefault<'borr, Item = Item> + InterfaceType<DoubleEndedIterator = Implemented<DoubleEndedIterator>>,
Item: 'borr,
impl<'borr, P, I, Item, EV> DoubleEndedIterator for DynTrait<'borr, P, I, EV>where
Self: Iterator<Item = Item>,
P: AsMutPtr,
I: IteratorItemOrDefault<'borr, Item = Item> + InterfaceType<DoubleEndedIterator = Implemented<DoubleEndedIterator>>,
Item: 'borr,
Source§fn next_back(&mut self) -> Option<Item>
fn next_back(&mut self) -> Option<Item>
Source§fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by
)n
elements. Read more1.37.0 · Source§fn nth_back(&mut self, n: usize) -> Option<Self::Item>
fn nth_back(&mut self, n: usize) -> Option<Self::Item>
n
th element from the end of the iterator. Read more1.27.0 · Source§fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
Iterator::try_fold()
: it takes
elements starting from the back of the iterator. Read moreSource§impl<'borr, P, I, EV> Drop for DynTrait<'borr, P, I, EV>where
P: GetPointerKind,
impl<'borr, P, I, EV> Drop for DynTrait<'borr, P, I, EV>where
P: GetPointerKind,
Source§impl<'borr, P, I, EV> Error for DynTrait<'borr, P, I, EV>where
P: AsPtr,
I: InterfaceType<Display = Implemented<Display>, Debug = Implemented<Debug>, Error = Implemented<Error>>,
impl<'borr, P, I, EV> Error for DynTrait<'borr, P, I, EV>where
P: AsPtr,
I: InterfaceType<Display = Implemented<Display>, Debug = Implemented<Debug>, Error = Implemented<Error>>,
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl<'borr, P, I, EV> GetStaticEquivalent_ for DynTrait<'borr, P, I, EV>where
P: GetPointerKind + __StableAbi,
I: __StableAbi + InterfaceType,
EV: __StableAbi,
VTable_Ref<'borr, P, I>: StableAbi,
impl<'borr, P, I, EV> GetStaticEquivalent_ for DynTrait<'borr, P, I, EV>where
P: GetPointerKind + __StableAbi,
I: __StableAbi + InterfaceType,
EV: __StableAbi,
VTable_Ref<'borr, P, I>: StableAbi,
Source§type StaticEquivalent = _static_DynTrait<'static, <P as GetStaticEquivalent_>::StaticEquivalent, <I as GetStaticEquivalent_>::StaticEquivalent, <EV as GetStaticEquivalent_>::StaticEquivalent>
type StaticEquivalent = _static_DynTrait<'static, <P as GetStaticEquivalent_>::StaticEquivalent, <I as GetStaticEquivalent_>::StaticEquivalent, <EV as GetStaticEquivalent_>::StaticEquivalent>
'static
equivalent of Self
Source§impl<'borr, P, I, Item, EV> Iterator for DynTrait<'borr, P, I, EV>where
P: AsMutPtr,
I: IteratorItemOrDefault<'borr, Item = Item> + InterfaceType<Iterator = Implemented<Iterator>>,
Item: 'borr,
impl<'borr, P, I, Item, EV> Iterator for DynTrait<'borr, P, I, EV>where
P: AsMutPtr,
I: IteratorItemOrDefault<'borr, Item = Item> + InterfaceType<Iterator = Implemented<Iterator>>,
Item: 'borr,
Source§fn next(&mut self) -> Option<Item>
fn next(&mut self) -> Option<Item>
Source§fn nth(&mut self, nth: usize) -> Option<Item>
fn nth(&mut self, nth: usize) -> Option<Item>
n
th element of the iterator. Read moreSource§fn size_hint(&self) -> (usize, Option<usize>)
fn size_hint(&self) -> (usize, Option<usize>)
Source§fn count(self) -> usize
fn count(self) -> usize
Source§fn next_chunk<const N: usize>(
&mut self,
) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where
Self: Sized,
fn next_chunk<const N: usize>(
&mut self,
) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where
Self: Sized,
iter_next_chunk
)N
values. Read moreSource§fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by
)n
elements. Read more1.28.0 · Source§fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
1.0.0 · Source§fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
1.0.0 · Source§fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where
Self: Sized,
U: IntoIterator,
fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where
Self: Sized,
U: IntoIterator,
Source§fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
iter_intersperse
)separator
between adjacent
items of the original iterator. Read moreSource§fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
iter_intersperse
)separator
between adjacent items of the original iterator. Read more1.0.0 · Source§fn map<B, F>(self, f: F) -> Map<Self, F>
fn map<B, F>(self, f: F) -> Map<Self, F>
1.0.0 · Source§fn filter<P>(self, predicate: P) -> Filter<Self, P>
fn filter<P>(self, predicate: P) -> Filter<Self, P>
1.0.0 · Source§fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
1.0.0 · Source§fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
1.0.0 · Source§fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 · Source§fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
1.57.0 · Source§fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
1.0.0 · Source§fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
n
elements. Read more1.0.0 · Source§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
n
elements, or fewer
if the underlying iterator ends sooner. Read more1.0.0 · Source§fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
1.29.0 · Source§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Source§fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
iter_map_windows
)f
for each contiguous window of size N
over
self
and returns an iterator over the outputs of f
. Like slice::windows()
,
the windows during mapping overlap as well. Read more1.0.0 · Source§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
1.0.0 · Source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Source§fn try_collect<B>(
&mut self,
) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
fn try_collect<B>( &mut self, ) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
iterator_try_collect
)Source§fn collect_into<E>(self, collection: &mut E) -> &mut E
fn collect_into<E>(self, collection: &mut E) -> &mut E
iter_collect_into
)1.0.0 · Source§fn partition<B, F>(self, f: F) -> (B, B)
fn partition<B, F>(self, f: F) -> (B, B)
Source§fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
iter_partition_in_place
)true
precede all those that return false
.
Returns the number of true
elements found. Read moreSource§fn is_partitioned<P>(self, predicate: P) -> bool
fn is_partitioned<P>(self, predicate: P) -> bool
iter_is_partitioned
)true
precede all those that return false
. Read more1.27.0 · Source§fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
1.27.0 · Source§fn try_for_each<F, R>(&mut self, f: F) -> R
fn try_for_each<F, R>(&mut self, f: F) -> R
1.0.0 · Source§fn fold<B, F>(self, init: B, f: F) -> B
fn fold<B, F>(self, init: B, f: F) -> B
1.51.0 · Source§fn reduce<F>(self, f: F) -> Option<Self::Item>
fn reduce<F>(self, f: F) -> Option<Self::Item>
Source§fn try_reduce<R>(
&mut self,
f: impl FnMut(Self::Item, Self::Item) -> R,
) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
fn try_reduce<R>( &mut self, f: impl FnMut(Self::Item, Self::Item) -> R, ) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
iterator_try_reduce
)1.0.0 · Source§fn all<F>(&mut self, f: F) -> bool
fn all<F>(&mut self, f: F) -> bool
1.0.0 · Source§fn any<F>(&mut self, f: F) -> bool
fn any<F>(&mut self, f: F) -> bool
1.0.0 · Source§fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
1.30.0 · Source§fn find_map<B, F>(&mut self, f: F) -> Option<B>
fn find_map<B, F>(&mut self, f: F) -> Option<B>
Source§fn try_find<R>(
&mut self,
f: impl FnMut(&Self::Item) -> R,
) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
fn try_find<R>( &mut self, f: impl FnMut(&Self::Item) -> R, ) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
try_find
)1.0.0 · Source§fn position<P>(&mut self, predicate: P) -> Option<usize>
fn position<P>(&mut self, predicate: P) -> Option<usize>
1.0.0 · Source§fn max(self) -> Option<Self::Item>
fn max(self) -> Option<Self::Item>
1.0.0 · Source§fn min(self) -> Option<Self::Item>
fn min(self) -> Option<Self::Item>
1.6.0 · Source§fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 · Source§fn max_by<F>(self, compare: F) -> Option<Self::Item>
fn max_by<F>(self, compare: F) -> Option<Self::Item>
1.6.0 · Source§fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 · Source§fn min_by<F>(self, compare: F) -> Option<Self::Item>
fn min_by<F>(self, compare: F) -> Option<Self::Item>
1.0.0 · Source§fn rev(self) -> Rev<Self>where
Self: Sized + DoubleEndedIterator,
fn rev(self) -> Rev<Self>where
Self: Sized + DoubleEndedIterator,
1.0.0 · Source§fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
1.36.0 · Source§fn copied<'a, T>(self) -> Copied<Self>
fn copied<'a, T>(self) -> Copied<Self>
Source§fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where
Self: Sized,
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where
Self: Sized,
iter_array_chunks
)N
elements of the iterator at a time. Read more1.11.0 · Source§fn product<P>(self) -> P
fn product<P>(self) -> P
Source§fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
iter_order_by
)Iterator
with those
of another with respect to the specified comparison function. Read more1.5.0 · Source§fn partial_cmp<I>(self, other: I) -> Option<Ordering>
fn partial_cmp<I>(self, other: I) -> Option<Ordering>
PartialOrd
elements of
this Iterator
with those of another. The comparison works like short-circuit
evaluation, returning a result without comparing the remaining elements.
As soon as an order can be determined, the evaluation stops and a result is returned. Read moreSource§fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
iter_order_by
)Iterator
with those
of another with respect to the specified comparison function. Read moreSource§fn eq_by<I, F>(self, other: I, eq: F) -> bool
fn eq_by<I, F>(self, other: I, eq: F) -> bool
iter_order_by
)1.5.0 · Source§fn lt<I>(self, other: I) -> bool
fn lt<I>(self, other: I) -> bool
Iterator
are lexicographically
less than those of another. Read more1.5.0 · Source§fn le<I>(self, other: I) -> bool
fn le<I>(self, other: I) -> bool
Iterator
are lexicographically
less or equal to those of another. Read more1.5.0 · Source§fn gt<I>(self, other: I) -> bool
fn gt<I>(self, other: I) -> bool
Iterator
are lexicographically
greater than those of another. Read more1.5.0 · Source§fn ge<I>(self, other: I) -> bool
fn ge<I>(self, other: I) -> bool
Iterator
are lexicographically
greater than or equal to those of another. Read more1.82.0 · Source§fn is_sorted(self) -> bool
fn is_sorted(self) -> bool
1.82.0 · Source§fn is_sorted_by<F>(self, compare: F) -> bool
fn is_sorted_by<F>(self, compare: F) -> bool
1.82.0 · Source§fn is_sorted_by_key<F, K>(self, f: F) -> bool
fn is_sorted_by_key<F, K>(self, f: F) -> bool
Source§impl<P, I, EV> Ord for DynTrait<'static, P, I, EV>
impl<P, I, EV> Ord for DynTrait<'static, P, I, EV>
Source§impl<P, P2, I, EV, EV2> PartialEq<DynTrait<'static, P2, I, EV2>> for DynTrait<'static, P, I, EV>
impl<P, P2, I, EV, EV2> PartialEq<DynTrait<'static, P2, I, EV2>> for DynTrait<'static, P, I, EV>
Source§impl<P, P2, I, EV, EV2> PartialOrd<DynTrait<'static, P2, I, EV2>> for DynTrait<'static, P, I, EV>where
P: AsPtr,
P2: AsPtr,
I: InterfaceType<PartialOrd = Implemented<PartialOrd>>,
Self: PartialEq<DynTrait<'static, P2, I, EV2>>,
impl<P, P2, I, EV, EV2> PartialOrd<DynTrait<'static, P2, I, EV2>> for DynTrait<'static, P, I, EV>where
P: AsPtr,
P2: AsPtr,
I: InterfaceType<PartialOrd = Implemented<PartialOrd>>,
Self: PartialEq<DynTrait<'static, P2, I, EV2>>,
Source§impl<'borr, P, I, EV> Read for DynTrait<'borr, P, I, EV>
impl<'borr, P, I, EV> Read for DynTrait<'borr, P, I, EV>
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
buf
. Read more1.36.0 · Source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
read
, except that it reads into a slice of buffers. Read moreSource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector
)1.0.0 · Source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
buf
. Read more1.0.0 · Source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
buf
. Read moreSource§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
read_buf
)Source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
read_buf
)cursor
. Read more1.0.0 · Source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Read
. Read moreSource§impl<'borr, P, I, EV> Seek for DynTrait<'borr, P, I, EV>
impl<'borr, P, I, EV> Seek for DynTrait<'borr, P, I, EV>
Source§fn seek(&mut self, pos: SeekFrom) -> Result<u64>
fn seek(&mut self, pos: SeekFrom) -> Result<u64>
1.55.0 · Source§fn rewind(&mut self) -> Result<(), Error>
fn rewind(&mut self) -> Result<(), Error>
Source§fn stream_len(&mut self) -> Result<u64, Error>
fn stream_len(&mut self) -> Result<u64, Error>
seek_stream_len
)Source§impl<'borr, P, I, EV> Serialize for DynTrait<'borr, P, I, EV>where
P: AsPtr,
I: InterfaceType<Serialize = Implemented<Serialize>> + GetSerializeProxyType<'borr>,
I::ProxyType: Serialize,
impl<'borr, P, I, EV> Serialize for DynTrait<'borr, P, I, EV>where
P: AsPtr,
I: InterfaceType<Serialize = Implemented<Serialize>> + GetSerializeProxyType<'borr>,
I::ProxyType: Serialize,
For an example of how to serialize DynTrait, look here
Source§impl<'borr, P, I, EV> StableAbi for DynTrait<'borr, P, I, EV>where
P: GetPointerKind + __StableAbi,
I: __StableAbi + InterfaceType,
EV: __StableAbi,
VTable_Ref<'borr, P, I>: StableAbi,
impl<'borr, P, I, EV> StableAbi for DynTrait<'borr, P, I, EV>where
P: GetPointerKind + __StableAbi,
I: __StableAbi + InterfaceType,
EV: __StableAbi,
VTable_Ref<'borr, P, I>: StableAbi,
Source§const LAYOUT: &'static TypeLayout = _
const LAYOUT: &'static TypeLayout = _
Source§type IsNonZeroType = False
type IsNonZeroType = False
Source§const ABI_CONSTS: AbiConsts = _
const ABI_CONSTS: AbiConsts = _
const
-equivalents of the associated types.Source§impl<'borr, P, I, EV> Write for DynTrait<'borr, P, I, EV>
impl<'borr, P, I, EV> Write for DynTrait<'borr, P, I, EV>
Source§impl<'borr, P, I, EV> Write for DynTrait<'borr, P, I, EV>
impl<'borr, P, I, EV> Write for DynTrait<'borr, P, I, EV>
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Source§fn write_all(&mut self, buf: &[u8]) -> Result<()>
fn write_all(&mut self, buf: &[u8]) -> Result<()>
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector
)Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored
)