Displaying 1 result from an estimated 1 matches for "alwaysrefcounted".
2024 May 30
0
[RFC PATCH 7/8] rust: add firmware abstractions
...ct device you should make sure to
increase the reference count of this device, such that it can't get freed for
the time being.
This is a 1:1 representation of that and conceptually identical.
>
> +// SAFETY: Instances of `Device` are always ref-counted.
> +unsafe impl crate::types::AlwaysRefCounted for Device {
> + fn inc_ref(&self) {
> + // SAFETY: The existence of a shared reference guarantees that the refcount is nonzero.
> + unsafe { bindings::get_device(self.as_raw()) };
> + }
> +
> + unsafe fn dec_ref(obj: ptr::NonNull<Self>) {
> +...