Struct fbp::fbp_threadsafe_wrapper::ThreadSafeType [−][src]
pub struct ThreadSafeType<T: Clone> { /* fields omitted */ }
Expand description
Generic Thread safe type
Implementations
Creates a new ThreadSafeType for a specific type
Example
Basic usage:
use fbp::fbp_threadsafe_wrapper::*;
let safe_bool = ThreadSafeType::new(false);
Create a new ThreadSafeType from an Arc<Mutex
Example
Basic usage:
use fbp::fbp_threadsafe_wrapper::*;
use std::sync::{Arc, Mutex, MutexGuard};
let an_arc = Arc::new(Mutex::new(false));
let safe_bool = ThreadSafeType::create(an_arc);
Return a MutexGuard
NOTE: MutexGuard
Example
Basic usage:
use fbp::fbp_threadsafe_wrapper::*;
use std::ops::Deref;
let safe_bool = ThreadSafeType::new(false);
let the_value = safe_bool.get_type();
if *the_value.deref() == true {
println!("The value is true");
} else {
println!("The value is false");
}
Return the underlying arc used by the ThreadSafeType
Example
Basic usage:
use fbp::fbp_threadsafe_wrapper::*;
use std::sync::{Arc, Mutex, MutexGuard};
let safe_bool = ThreadSafeType::new(false);
let the_arc = safe_bool.get_arc();
Change the underlying arc used by the threadSafeType
Example
Basic usage:
use fbp::fbp_threadsafe_wrapper::*;
use std::sync::{Arc, Mutex, MutexGuard};
let mut safe_bool = ThreadSafeType::new(false);
let new_arc = Arc::new(Mutex::new(true));
safe_bool.set_arc(new_arc);
Trait Implementations
Returns the “default value” for a type. Read more
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for ThreadSafeType<T>
impl<T> Send for ThreadSafeType<T> where
T: Send,
impl<T> Sync for ThreadSafeType<T> where
T: Send,
impl<T> Unpin for ThreadSafeType<T>
impl<T> UnwindSafe for ThreadSafeType<T>
Blanket Implementations
Mutably borrows from an owned value. Read more