Trait AccessControl

Source
pub unsafe trait AccessControl {
    type Sentinel: Send + 'static;

    // Required method
    unsafe fn apply(
        self,
        config: &mut UA_ServerConfig,
    ) -> Result<Self::Sentinel>;
}
Expand description

Server access control.

§Safety

The implementation of apply() must make sure that existing access control settings in config have been completely replaced or otherwise cleaned up when it returns without an error.

This is needed to allow dropping sentinel values received from previous calls to apply() (by different implementations of the trait, possibly) in case ServerBuilder::access_control() is called twice.

Required Associated Types§

Source

type Sentinel: Send + 'static

Sentinel value returned from Self::apply().

This allows cleaning up data associated with this instance after the server has shut down, releasing the access control and not making use of it again.

Required Methods§

Source

unsafe fn apply(self, config: &mut UA_ServerConfig) -> Result<Self::Sentinel>

Consumes instance and applies it to config.

§Errors

This fails when the access control cannot be applied.

§Safety

The caller must keep the sentinel value around (not drop it) for as long as the config which had this access control applied to is still active, i.e. the server has not been shut down.

Implementors§