Skip to main content

Utils

Trait Utils 

Source
pub trait Utils {
    const DEFAULT_ROPE_BUILDER_BUFFER_SIZE: usize = 8192;
    const IS_EXTENDED: bool = true;
    const NEWLINE: &str = "\n";
    const READ_FROM_CLIPBOARD_COMMAND: &str = "pbpaste";
    const WRITE_TO_CLIPBOARD_COMMAND: &str = "pbcopy";
Show 73 methods // Provided methods async fn achain<T: Future>(self, rhs: T) -> T::Output where Self: Future + Sized { ... } fn arc(self) -> Arc<Self> where Self: Sized { ... } async fn async_with<T>(self, next: impl Future<Output = T>) -> T where Self: Future + Sized { ... } fn as_borrowed<'a, B: ?Sized + ToOwned>(&'a self) -> &'a B where Self: Borrow<Cow<'a, B>> { ... } fn as_immut(&mut self) -> &Self { ... } fn as_ptr(&self) -> *const Self { ... } fn as_ptr_mut(&mut self) -> *mut Self { ... } fn as_utf8(&self) -> Result<&str, Utf8Error> where Self: AsRef<[u8]> { ... } fn borrowed(&self) -> Cow<'_, Self> where Self: ToOwned { ... } fn buf_reader(self) -> BufReader<Self> where Self: Read + Sized { ... } fn buf_writer(self) -> BufWriter<Self> where Self: Write + Sized { ... } fn cast_ref<T>(&self) -> &T { ... } fn cat<T: Display>(&self, rhs: T) -> String where Self: Display { ... } fn convert<T: From<Self>>(self) -> T where Self: Sized { ... } fn contains_eq<Q, K>(&self, query: Q) -> bool where Self: AsRef<[K]>, for<'a> &'a K: PartialEq<Q> { ... } fn copied(&self) -> Self where Self: Copy + Sized { ... } fn create(&self) -> Result<File, IoError> where Self: AsRef<Path> { ... } fn create_dir_all(&self) -> Result<(), IoError> where Self: AsRef<Path> { ... } fn err<T>(self) -> Result<T, Self> where Self: Sized { ... } fn find_eq<Q, K>(&self, query: Q) -> Option<(usize, &K)> where Self: AsRef<[K]>, for<'a> &'a K: PartialEq<Q> { ... } fn has_happened(self) -> bool where Self: Is<Instant> { ... } fn if_else<T>(self, true_value: T, false_value: T) -> T where Self: Is<bool> { ... } fn immutable(&mut self) -> &Self { ... } fn inc(&self) -> usize where Self: Borrow<AtomicUsize> { ... } fn insert_mut<'a, K: 'a + Eq + Hash, V>( &'a mut self, key: K, value: V, ) -> &'a mut V where Self: BorrowMut<HashMap<K, V>> { ... } fn into_box(self) -> Box<Self> where Self: Sized { ... } fn into_break<C>(self) -> ControlFlow<Self, C> where Self: Sized { ... } fn into_continue<B>(self) -> ControlFlow<B, Self> where Self: Sized { ... } fn into_manually_drop(self) -> ManuallyDrop<Self> where Self: Sized { ... } fn io_error(self) -> IoError where Self: Into<Box<dyn StdError + Send + Sync>> { ... } fn io_result<T, E: Into<Box<dyn StdError + Send + Sync>>>( self, ) -> Result<T, IoError> where Self: Is<Result<T, E>> { ... } fn is_less_than<T: PartialOrd>(self, rhs: T) -> bool where Self: Into<T> { ... } fn map_collect<Y, T: FromIterator<Y>>( self, func: impl FnMut(Self::Item) -> Y, ) -> T where Self: IntoIterator + Sized { ... } fn map_into<Y, X: Into<Y>>(self) -> Option<Y> where Self: Is<Option<X>> { ... } fn map_as_ref<'a, Y: ?Sized, X: 'a + AsRef<Y>>(&'a self) -> Option<&'a Y> where Self: Borrow<Option<X>> { ... } fn mem_drop(self) where Self: Sized { ... } fn mem_replace(&mut self, value: Self) -> Self where Self: Sized { ... } fn mem_take(&mut self) -> Self where Self: Default { ... } fn mut_push<T>(&mut self, item: T) -> &mut T where Self: BorrowMut<Vec<T>> { ... } fn ok<E>(self) -> Result<Self, E> where Self: Sized { ... } fn once(self) -> Once<Self> where Self: Sized { ... } fn open(&self) -> Result<File, IoError> where Self: AsRef<Path> { ... } fn owned<B: ?Sized + ToOwned<Owned = Self>>(self) -> Cow<'static, B> where Self: Sized { ... } fn pair<T>(self, rhs: T) -> (Self, T) where Self: Sized { ... } fn pin(self) -> Pin<Box<Self>> where Self: Sized { ... } fn pipe<X, Y, Z, F: FnMut(Y) -> Z>(self, func: F) -> impl FnMut(X) -> Z where Self: Sized + FnMut(X) -> Y { ... } fn poll_ready(self) -> Poll<Self> where Self: Sized { ... } fn pipe_into<T, F: FnOnce(Self) -> T>(self, func: F) -> T where Self: Sized { ... } fn println(&self) where Self: Display { ... } fn print(&self) where Self: Display { ... } fn push_to<T: Extend<Self>>(self, collection: &mut T) where Self: Sized { ... } fn push_all_to<T: Extend<Self::Item>>(self, collection: &mut T) where Self: IntoIterator + Sized { ... } fn range_from_len(self, len: Self) -> Range<Self> where Self: Add<Output = Self> + Copy { ... } fn ready(self) -> Ready<Self> where Self: Sized { ... } fn ref_immut(&self) -> &Self { ... } fn ref_mut(&mut self) -> &mut Self { ... } fn repeat(self) -> Repeat<Self> where Self: Clone { ... } fn reversed<X, Y>(self) -> (Y, X) where Self: Is<(X, Y)> { ... } fn remove_file(&self) -> Result<(), IoError> where Self: AsRef<Path> { ... } fn set_true(&mut self) -> bool where Self: BorrowMut<bool> { ... } fn set_false(&mut self) -> bool where Self: BorrowMut<bool> { ... } fn some(self) -> Option<Self> where Self: Sized { ... } fn substr_interval(&self, query: &[u8]) -> Option<(usize, usize)> where Self: AsRef<[u8]> { ... } fn toggle(&mut self) where Self: BorrowMut<bool> { ... } fn try_convert<T: TryFrom<Self>>(self) -> Result<T, T::Error> where Self: Sized { ... } fn type_name() -> &'static str { ... } fn unit(&self) { ... } async fn wait_then_unwrap_or_pending<T>(self) -> T where Self: Future<Output = Option<T>> + Sized { ... } async fn unwrap_or_pending_then_wait<F: Future + Unpin>( &mut self, ) -> F::Output where Self: BorrowMut<Option<F>> { ... } fn with<T>(&self, value: T) -> T { ... } fn with_item_pushed<T>(self, item: T) -> Vec<T> where Self: Is<Vec<T>> { ... } fn with_str_pushed(self, rhs: &str) -> String where Self: Is<String> { ... } fn write_all_then(&mut self, byte_str: &[u8]) -> Result<&mut Self, IoError> where Self: Write { ... }
}

Provided Associated Constants§

Provided Methods§

Source

async fn achain<T: Future>(self, rhs: T) -> T::Output
where Self: Future + Sized,

Source

fn arc(self) -> Arc<Self>
where Self: Sized,

Source

async fn async_with<T>(self, next: impl Future<Output = T>) -> T
where Self: Future + Sized,

Source

fn as_borrowed<'a, B: ?Sized + ToOwned>(&'a self) -> &'a B
where Self: Borrow<Cow<'a, B>>,

Source

fn as_immut(&mut self) -> &Self

Source

fn as_ptr(&self) -> *const Self

Source

fn as_ptr_mut(&mut self) -> *mut Self

Source

fn as_utf8(&self) -> Result<&str, Utf8Error>
where Self: AsRef<[u8]>,

Source

fn borrowed(&self) -> Cow<'_, Self>
where Self: ToOwned,

Source

fn buf_reader(self) -> BufReader<Self>
where Self: Read + Sized,

Source

fn buf_writer(self) -> BufWriter<Self>
where Self: Write + Sized,

Source

fn cast_ref<T>(&self) -> &T

Source

fn cat<T: Display>(&self, rhs: T) -> String
where Self: Display,

Source

fn convert<T: From<Self>>(self) -> T
where Self: Sized,

Source

fn contains_eq<Q, K>(&self, query: Q) -> bool
where Self: AsRef<[K]>, for<'a> &'a K: PartialEq<Q>,

Source

fn copied(&self) -> Self
where Self: Copy + Sized,

Source

fn create(&self) -> Result<File, IoError>
where Self: AsRef<Path>,

Source

fn create_dir_all(&self) -> Result<(), IoError>
where Self: AsRef<Path>,

Source

fn err<T>(self) -> Result<T, Self>
where Self: Sized,

Source

fn find_eq<Q, K>(&self, query: Q) -> Option<(usize, &K)>
where Self: AsRef<[K]>, for<'a> &'a K: PartialEq<Q>,

Source

fn has_happened(self) -> bool
where Self: Is<Instant>,

Source

fn if_else<T>(self, true_value: T, false_value: T) -> T
where Self: Is<bool>,

Source

fn immutable(&mut self) -> &Self

Source

fn inc(&self) -> usize
where Self: Borrow<AtomicUsize>,

Source

fn insert_mut<'a, K: 'a + Eq + Hash, V>( &'a mut self, key: K, value: V, ) -> &'a mut V
where Self: BorrowMut<HashMap<K, V>>,

Source

fn into_box(self) -> Box<Self>
where Self: Sized,

Source

fn into_break<C>(self) -> ControlFlow<Self, C>
where Self: Sized,

Source

fn into_continue<B>(self) -> ControlFlow<B, Self>
where Self: Sized,

Source

fn into_manually_drop(self) -> ManuallyDrop<Self>
where Self: Sized,

Source

fn io_error(self) -> IoError
where Self: Into<Box<dyn StdError + Send + Sync>>,

Source

fn io_result<T, E: Into<Box<dyn StdError + Send + Sync>>>( self, ) -> Result<T, IoError>
where Self: Is<Result<T, E>>,

Source

fn is_less_than<T: PartialOrd>(self, rhs: T) -> bool
where Self: Into<T>,

Source

fn map_collect<Y, T: FromIterator<Y>>( self, func: impl FnMut(Self::Item) -> Y, ) -> T
where Self: IntoIterator + Sized,

Source

fn map_into<Y, X: Into<Y>>(self) -> Option<Y>
where Self: Is<Option<X>>,

Source

fn map_as_ref<'a, Y: ?Sized, X: 'a + AsRef<Y>>(&'a self) -> Option<&'a Y>
where Self: Borrow<Option<X>>,

Source

fn mem_drop(self)
where Self: Sized,

Source

fn mem_replace(&mut self, value: Self) -> Self
where Self: Sized,

Source

fn mem_take(&mut self) -> Self
where Self: Default,

Source

fn mut_push<T>(&mut self, item: T) -> &mut T
where Self: BorrowMut<Vec<T>>,

Source

fn ok<E>(self) -> Result<Self, E>
where Self: Sized,

Source

fn once(self) -> Once<Self>
where Self: Sized,

Source

fn open(&self) -> Result<File, IoError>
where Self: AsRef<Path>,

Source

fn owned<B: ?Sized + ToOwned<Owned = Self>>(self) -> Cow<'static, B>
where Self: Sized,

Source

fn pair<T>(self, rhs: T) -> (Self, T)
where Self: Sized,

Source

fn pin(self) -> Pin<Box<Self>>
where Self: Sized,

Source

fn pipe<X, Y, Z, F: FnMut(Y) -> Z>(self, func: F) -> impl FnMut(X) -> Z
where Self: Sized + FnMut(X) -> Y,

Source

fn poll_ready(self) -> Poll<Self>
where Self: Sized,

Source

fn pipe_into<T, F: FnOnce(Self) -> T>(self, func: F) -> T
where Self: Sized,

Source

fn println(&self)
where Self: Display,

Source

fn print(&self)
where Self: Display,

Source

fn push_to<T: Extend<Self>>(self, collection: &mut T)
where Self: Sized,

Source

fn push_all_to<T: Extend<Self::Item>>(self, collection: &mut T)
where Self: IntoIterator + Sized,

Source

fn range_from_len(self, len: Self) -> Range<Self>
where Self: Add<Output = Self> + Copy,

Source

fn ready(self) -> Ready<Self>
where Self: Sized,

Source

fn ref_immut(&self) -> &Self

Source

fn ref_mut(&mut self) -> &mut Self

Source

fn repeat(self) -> Repeat<Self>
where Self: Clone,

Source

fn reversed<X, Y>(self) -> (Y, X)
where Self: Is<(X, Y)>,

Source

fn remove_file(&self) -> Result<(), IoError>
where Self: AsRef<Path>,

Source

fn set_true(&mut self) -> bool
where Self: BorrowMut<bool>,

Source

fn set_false(&mut self) -> bool
where Self: BorrowMut<bool>,

Source

fn some(self) -> Option<Self>
where Self: Sized,

Source

fn substr_interval(&self, query: &[u8]) -> Option<(usize, usize)>
where Self: AsRef<[u8]>,

Source

fn toggle(&mut self)
where Self: BorrowMut<bool>,

Source

fn try_convert<T: TryFrom<Self>>(self) -> Result<T, T::Error>
where Self: Sized,

Source

fn type_name() -> &'static str

Source

fn unit(&self)

Source

async fn wait_then_unwrap_or_pending<T>(self) -> T
where Self: Future<Output = Option<T>> + Sized,

Source

async fn unwrap_or_pending_then_wait<F: Future + Unpin>(&mut self) -> F::Output
where Self: BorrowMut<Option<F>>,

Source

fn with<T>(&self, value: T) -> T

Source

fn with_item_pushed<T>(self, item: T) -> Vec<T>
where Self: Is<Vec<T>>,

Source

fn with_str_pushed(self, rhs: &str) -> String
where Self: Is<String>,

Source

fn write_all_then(&mut self, byte_str: &[u8]) -> Result<&mut Self, IoError>
where Self: Write,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T: ?Sized> Utils for T