Trait GroupOperations

Source
pub trait GroupOperations {
    type Child: 'static;

    const USE_VTABLE_ATTR: ();
    const HAS_MAKE_GROUP: bool = false;
    const HAS_DROP_ITEM: bool = false;

    // Required method
    fn make_group(
        &self,
        name: &CStr,
    ) -> Result<impl PinInit<Group<Self::Child>, Error>>;

    // Provided method
    fn drop_item(&self, _child: ArcBorrow<'_, Group<Self::Child>>) { ... }
}
Expand description

Operations implemented by configfs groups that can create subgroups.

Implement this trait on structs that embed a Subsystem or a Group.

Required Associated Constants§

Source

const USE_VTABLE_ATTR: ()

A marker to prevent implementors from forgetting to use #[vtable] attribute when implementing this trait.

Provided Associated Constants§

Source

const HAS_MAKE_GROUP: bool = false

Indicates if the make_group method is overridden by the implementor.

Source

const HAS_DROP_ITEM: bool = false

Indicates if the drop_item method is overridden by the implementor.

Required Associated Types§

Source

type Child: 'static

The child data object type.

This group will create subgroups (subdirectories) backed by this kind of object.

Required Methods§

Source

fn make_group( &self, name: &CStr, ) -> Result<impl PinInit<Group<Self::Child>, Error>>

Creates a new subgroup.

The kernel will call this method in response to mkdir(2) in the directory representing this.

To accept the request to create a group, implementations should return an initializer of a Group<Self::Child>. To prevent creation, return a suitable error.

Provided Methods§

Source

fn drop_item(&self, _child: ArcBorrow<'_, Group<Self::Child>>)

Prepares the group for removal from configfs.

The kernel will call this method before the directory representing _child is removed from configfs.

Implementations can use this method to do house keeping before configfs drops its reference to Child.

NOTE: “drop” in the name of this function is not related to the Rust drop term. Rather, the name is inherited from the callback name in the underlying C code.

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§