pub struct GuestResource {
pub handle: GuestResourceHandle,
pub planes: Vec<FramePlane>,
pub width: u32,
pub height: u32,
pub format: Format,
pub guest_cpu_mappable: bool,
}
Fields§
§handle: GuestResourceHandle
Handle to the backing memory.
planes: Vec<FramePlane>
Layout of color planes, if the resource will receive frames.
width: u32
§height: u32
§format: Format
§guest_cpu_mappable: bool
Whether the buffer can be accessed by the guest CPU. This means the host must ensure that all operations on the buffer are completed before passing it to the guest.
Implementations§
source§impl GuestResource
impl GuestResource
sourcepub fn from_virtio_guest_mem_entry(
mem_entries: &[virtio_video_mem_entry],
mem: &GuestMemory,
params: &Params
) -> Result<GuestResource, GuestMemResourceCreationError>
pub fn from_virtio_guest_mem_entry( mem_entries: &[virtio_video_mem_entry], mem: &GuestMemory, params: &Params ) -> Result<GuestResource, GuestMemResourceCreationError>
Try to convert an unresolved virtio guest memory entry into a resolved guest memory resource.
Convert mem_entry
into the guest memory resource it represents and resolve it through
mem
.
Width, height and format is set from params
.
Panics if params.format
is None
.
sourcepub fn from_virtio_object_entry(
object: virtio_video_object_entry,
res_bridge: &Tube,
params: &Params
) -> Result<GuestResource, ObjectResourceCreationError>
pub fn from_virtio_object_entry( object: virtio_video_object_entry, res_bridge: &Tube, params: &Params ) -> Result<GuestResource, ObjectResourceCreationError>
Try to convert an unresolved virtio object entry into a resolved object resource.
Convert object
into the object resource it represents and resolve it through res_bridge
.
Returns an error if the object’s UUID is invalid or cannot be resolved to a buffer object
by res_bridge
.
pub fn try_clone(&self) -> Result<Self, Error>
Trait Implementations§
source§impl AsBufferHandle for GuestResource
impl AsBufferHandle for GuestResource
type BufferHandle = GuestResourceHandle
fn as_buffer_handle(&self) -> &Self::BufferHandle
source§impl TryAsAvFrameExt for GuestResource
impl TryAsAvFrameExt for GuestResource
type BufferSource = MemoryMappingArena
type Error = GuestResourceToAvFrameError
source§fn try_as_av_frame<T: AvBufferSource + 'static>(
&self,
wrapper: impl FnOnce(MemoryMappingArena) -> T
) -> Result<AvFrame, Self::Error>
fn try_as_av_frame<T: AvBufferSource + 'static>( &self, wrapper: impl FnOnce(MemoryMappingArena) -> T ) -> Result<AvFrame, Self::Error>
Auto Trait Implementations§
impl RefUnwindSafe for GuestResource
impl Send for GuestResource
impl Sync for GuestResource
impl Unpin for GuestResource
impl UnwindSafe for GuestResource
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.