/// A single character spinner with optional title that can be told to spin whenever it wants. It implements `Spinner` trait, and is the default spinner.
///
/// The spinner takes up a line, and renders it's spinner on the end of its title. Calling the `Spinner::bump()` function will cause the character sequence to advance.
///
/// # Usage
/// To use the spinner you can provide it a `Wheel` (see [[wheel]] module), or it implements the `Default` trait, creating a traditional looking spinner (`|/-\`)
/// This type is safely `Sync` (where `T` is), the behaviour is defined to prevent overlapping writes to `T`.
/// Though it is *advised* to not render a `Spin` from more than a single thread, you still safely can.
///
/// A display operation on one thread will cause any other threads attempting on to silently and safely abort their display attempt before anything is written to output.
pubstructSpin<T: ?Sized=DefaultOutputDevice>/*<T: ?Sized = DefaultOutputDevice>*///TODO: <- implement same as `Bar
/// Create a new blank spinner with a wheel writing to `stdout`.
///
/// # Example
/// ```rust
/// # use termprogress::prelude::*;
/// Spin::new_default(Default::default()); // Create a spinner with the default wheel ('|/-\') that writes to stdout.
/// ```
#[inline]
pubfnnew_default(whl: wheel::Wheel)-> Self
{
Self::new(create_default_output_device(),whl)
}
}
impl<T>Spin<T>
{
/// Return the backing write object
#[inline]
pubfninto_inner(self)-> T
{
self.output.into_inner()
}
}
impl<T: ?Sized>Spin<T>
{
/// Get a mutable reference to the inner object
#[inline]
pubfninner_mut(&mutself)-> &mutT
{
self.output.get_mut()
}
/// Get a shared reference to the inner object
///
/// # Returns
/// `None` is returned if a display operation is currently in progress on another thread.
///
/// ## Operation suspension
/// As long as the returned reference lives, **all** display operations will fail silently, on this thread and any other. This method should be avoided in favour of `&*inner_mut()` when exclusive ownership is avaliable.