pub trait TryAsAvFrameExt {
type BufferSource;
type Error: Error;
// Required method
fn try_as_av_frame<T: AvBufferSource + 'static>(
&self,
wrapper: impl FnOnce(Self::BufferSource) -> T
) -> Result<AvFrame, Self::Error>;
}
Required Associated Types§
type BufferSource
type Error: Error
Required Methods§
sourcefn try_as_av_frame<T: AvBufferSource + 'static>(
&self,
wrapper: impl FnOnce(Self::BufferSource) -> T
) -> Result<AvFrame, Self::Error>
fn try_as_av_frame<T: AvBufferSource + 'static>( &self, wrapper: impl FnOnce(Self::BufferSource) -> T ) -> Result<AvFrame, Self::Error>
Try to create an AvFrame
from self
.
wrapper
is a constructor for T
that wraps Self::BufferSource
and implement the
AvBufferSource
functionality. This can be used to provide a custom destructor
implementation: for example, sending a virtio message signaling the buffer source is no
longer used and it can be recycled by the guest.
Note that Self::BufferSource
might not always implement AvBufferSource
. For instance,
it’s not guaranteed that a MemoryMappingArena
created from GuestResource
will be always
immutable, and the backend need to explicit acknowledge the potential unsoundness by
wrapping it in MemoryMappingAvBufferSource
.
Object Safety§
This trait is not object safe.