Trait HasGroup

Source
pub unsafe trait HasGroup<Data> {
    // Required methods
    unsafe fn group(this: *const Self) -> *const config_group;
    unsafe fn container_of(group: *const config_group) -> *const Self;
}
Expand description

Trait that allows offset calculations for structs that embed a bindings::config_group.

Users of the configfs API should not need to implement this trait.

§Safety

  • Implementers of this trait must embed a bindings::config_group.
  • Methods must be implemented according to method documentation.

Required Methods§

Source

unsafe fn group(this: *const Self) -> *const config_group

Return the address of the bindings::config_group embedded in Self.

§Safety
  • this must be a valid allocation of at least the size of Self.
Source

unsafe fn container_of(group: *const config_group) -> *const Self

Return the address of the Self that group is embedded in.

§Safety
  • group must point to the bindings::config_group that is embedded in Self.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Data> HasGroup<Data> for Group<Data>

Source§

impl<Data> HasGroup<Data> for Subsystem<Data>