pub struct STDOUT { /* private fields */ }Expand description
STDOUT is a printer output that is used by the print/println macros to display text on the standard output.
Methods from Deref<Target = Mutex<StaticPrinter>>§
Sourcepub fn lock(&self) -> MutexGuard<'_, T>
pub fn lock(&self) -> MutexGuard<'_, T>
Locks the Mutex and returns a guard that permits access to the inner data.
The returned value may be dereferenced for data access and the lock will be dropped when the guard falls out of scope.
let lock = spin::Mutex::new(0);
{
let mut data = lock.lock();
// The lock is now locked and the data can be accessed
*data += 1;
// The lock is implicitly dropped at the end of the scope
}Sourcepub fn is_locked(&self) -> bool
pub fn is_locked(&self) -> bool
Returns true if the lock is currently held.
§Safety
This function provides no synchronization guarantees and so its result should be considered ‘out of date’ the instant it is called. Do not use it for synchronization purposes. However, it may be useful as a heuristic.
Sourcepub unsafe fn force_unlock(&self)
pub unsafe fn force_unlock(&self)
Sourcepub fn try_lock(&self) -> Option<MutexGuard<'_, T>>
pub fn try_lock(&self) -> Option<MutexGuard<'_, T>>
Trait Implementations§
Source§impl Deref for STDOUT
impl Deref for STDOUT
Source§type Target = Mutex<StaticPrinter>
type Target = Mutex<StaticPrinter>
The resulting type after dereferencing.
Source§fn deref(&self) -> &Mutex<StaticPrinter>
fn deref(&self) -> &Mutex<StaticPrinter>
Dereferences the value.
impl LazyStatic for STDOUT
Auto Trait Implementations§
impl Freeze for STDOUT
impl RefUnwindSafe for STDOUT
impl Send for STDOUT
impl Sync for STDOUT
impl Unpin for STDOUT
impl UnsafeUnpin for STDOUT
impl UnwindSafe for STDOUT
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