Skip to main content

PropertyBlob

Struct PropertyBlob 

Source
pub struct PropertyBlob<'a> { /* private fields */ }
Expand description

A kernel property blob, freed when it is dropped.

MODE_ID takes a blob id rather than a value, so a scene that sets a mode has to create one and keep it alive for as long as the mode is set. Letting it leak would be invisible until a long-running compositor that re-modesets often ran the kernel out of blob ids.

The borrow of the device is what makes freeing it safe. Holding a raw descriptor instead would compile, and would destroy a blob on whatever the kernel had since recycled that number into if the blob ever outlived the device it came from.

Implementations§

Source§

impl PropertyBlob<'_>

Source

pub const fn id(&self) -> u64

The blob id, to be written into a blob-typed property.

Source

pub fn forget(self)

Give up the blob without asking the kernel to destroy it.

For when the descriptor the blob was created on is gone – a libseat session pause revokes it, and the kernel reclaimed every blob on it at that moment. Destroying through the replacement descriptor would at best fail and at worst free a different blob that happens to have been given the same id there.

This leaks nothing: the blob is already gone. Do not reach for it to silence an ordinary drop – on a live descriptor that really is a leak, and a long-running compositor that re-modesets will run the kernel out of blob ids.

Trait Implementations§

Source§

impl Debug for PropertyBlob<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

The id, without the device – a blob is identified by its id, and printing the device behind it would be noise at best.

Source§

impl Drop for PropertyBlob<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for PropertyBlob<'a>

§

impl<'a> RefUnwindSafe for PropertyBlob<'a>

§

impl<'a> Send for PropertyBlob<'a>

§

impl<'a> Sync for PropertyBlob<'a>

§

impl<'a> Unpin for PropertyBlob<'a>

§

impl<'a> UnsafeUnpin for PropertyBlob<'a>

§

impl<'a> UnwindSafe for PropertyBlob<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.