pub struct Token { /* private fields */ }Expand description
Handle for a dynamically created OPP.
The associated OPP is automatically removed when the Token is dropped.
§Examples
The following example demonstrates how to create an OPP dynamically.
use kernel::clk::Hertz;
use kernel::device::Device;
use kernel::error::Result;
use kernel::opp::{Data, MicroVolt, Token};
use kernel::sync::aref::ARef;
fn create_opp(dev: &ARef<Device>, freq: Hertz, volt: MicroVolt, level: u32) -> Result<Token> {
let data = Data::new(freq, volt, level, false);
// OPP is removed once token goes out of scope.
data.add_opp(dev)
}Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Token
impl !UnwindSafe for Token
impl Freeze for Token
impl Send for Token
impl Sync for Token
impl Unpin for Token
impl UnsafeUnpin for Token
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<S, T> IntoSafeCast<T> for Swhere
T: FromSafeCast<S>,
impl<S, T> IntoSafeCast<T> for Swhere
T: FromSafeCast<S>,
Source§fn into_safe_cast(self) -> T
fn into_safe_cast(self) -> T
Convert
self into a T. This operation is guaranteed to be lossless.Source§impl<S, T> IntoSafeCastArch<T> for Swhere
T: FromSafeCastArch<S>,
impl<S, T> IntoSafeCastArch<T> for Swhere
T: FromSafeCastArch<S>,
Source§fn into_safe_cast_arch(self) -> T
fn into_safe_cast_arch(self) -> T
Convert
self into a T. This operation is guaranteed to be lossless.