Skip to main content

Model

Trait Model 

Source
pub trait Model:
    Send
    + Sync
    + 'static { }
Expand description

What a device model has to be, gathering in one bound everything a server needs of it: it is shared between the threads serving the requests.

A model is deleted by being given to the delete function of its class, see ClassDef::delete, which is where it releases what it holds: before every initialization but the first, and once its device is no longer served. A model whose server is dropped without being stopped, see Server::stop_async, is never deleted, and only dropped with the last reference to its device, which may be held long after. Its Drop is therefore only relied upon to free memory, never to release its hardware or anything else that the new model of a device restarted under the same name takes again.

Every such type is a model, there being nothing to implement: this is the bound the definitions and the devices are written against rather than a trait a model opts into.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: Send + Sync + 'static> Model for T