pub struct StaticErr<T> { /* private fields */ }Implementations§
Source§impl<T> StaticErr<T>
impl<T> StaticErr<T>
pub const fn new(arg: T, err: StaticInitErr) -> Self
Sourcepub const fn prev(arg: T) -> Self
pub const fn prev(arg: T) -> Self
Examples found in repository?
examples/drop.rs (line 25)
20fn main() -> Result<(), StaticErr<MyDrop>> {
21 DROPPER.set(MyDrop(1))?;
22 println!("OK #0 this_value {:?}", DROPPER);
23
24 let err = DROPPER.set(MyDrop(2));
25 assert_eq!(err, Err(StaticErr::prev(MyDrop(2))) );
26 println!("OK #1 this_value {:?}", DROPPER);
27
28 let err = DROPPER.set(MyDrop(3));
29 assert_eq!(err, Err(StaticErr::prev(MyDrop(3))) );
30 println!("OK #2 this_value {:?}", DROPPER);
31
32 Ok( () )
33}More examples
examples/data.rs (line 30)
16fn main() {
17 assert_eq!(*TEST, TestValue::Unk);
18 println!("OK #1 {:?}", TEST);
19
20 let result = TEST.set(TestValue::RuntimeValue(10));
21 assert_eq!(result.is_ok(), true);
22 println!("OK #2 {:?}", TEST);
23
24 let result = TEST.set(TestValue::RuntimeValue(20));
25 assert_eq!(result.is_ok(), false);
26 assert_eq!(*TEST, TestValue::RuntimeValue(10));
27 println!("OK #3 {:?}", TEST);
28
29 let result = TEST.replace(TestValue::Unk);
30 assert_eq!(result, Err(StaticErr::prev(TestValue::Unk)));
31 println!("OK #4 {:?}", result);
32}pub const fn allow(arg: T) -> Self
pub const fn unk(arg: T) -> Self
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
pub fn into_type(self) -> StaticInitErr
pub const fn as_type(&self) -> &StaticInitErr
pub const fn as_inner(&self) -> &T
Trait Implementations§
Source§impl<T> From<(T, StaticInitErr)> for StaticErr<T>
impl<T> From<(T, StaticInitErr)> for StaticErr<T>
Source§fn from((v, t): (T, StaticInitErr)) -> Self
fn from((v, t): (T, StaticInitErr)) -> Self
Converts to this type from the input type.
Source§impl<T: PartialOrd> PartialOrd for StaticErr<T>
impl<T: PartialOrd> PartialOrd for StaticErr<T>
impl<T> StructuralPartialEq for StaticErr<T>
Auto Trait Implementations§
impl<T> Freeze for StaticErr<T>where
T: Freeze,
impl<T> RefUnwindSafe for StaticErr<T>where
T: RefUnwindSafe,
impl<T> Send for StaticErr<T>where
T: Send,
impl<T> Sync for StaticErr<T>where
T: Sync,
impl<T> Unpin for StaticErr<T>where
T: Unpin,
impl<T> UnwindSafe for StaticErr<T>where
T: UnwindSafe,
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