#[cfg(all(doc, feature = "std"))]
use std::path::Path;
#[cfg(all(doc, feature = "std"))]
use std::ffi::OsStr;
pub trait Len {
fn len(&self) -> usize;
}
impl Len for str {
fn len(&self) -> usize {
self.len()
}
}
pub trait Collection {
type Item;
}
impl crate::Collection for str {
type Item = char;
}
#[cfg(feature = "alloc")]
pub trait Reserve {
fn reserve(&mut self, capacity: usize);
fn with_capacity(capacity: usize) -> Self where Self: Default {
let mut collection = Self::default();
collection.reserve(capacity);
collection
}
}
pub trait First: Collection {
fn first(&self) -> Option<&Self::Item>;
}
pub trait FirstMut: First {
fn first_mut(&mut self) -> Option<&mut Self::Item>;
}
pub trait Last: Collection {
fn last(&self) -> Option<&Self::Item>;
}
pub trait LastMut: Collection {
fn last_mut(&mut self) -> Option<&mut Self::Item>;
}
pub trait PopFirst: Collection {
fn pop_first(&mut self) -> Option<Self::Item>;
}
pub trait PopLast: Collection {
fn pop_last(&mut self) -> Option<Self::Item>;
}
pub unsafe trait SliceOrSized {}
unsafe impl<T> SliceOrSized for T {}
unsafe impl<T> SliceOrSized for [T] {}
unsafe impl SliceOrSized for str {}
pub(crate) trait FromInner {
type Inner;
unsafe fn from_inner(inner: Self::Inner) -> Self;
}
pub unsafe trait FixedLenCollection {}
unsafe impl<T> FixedLenCollection for [T] {}
unsafe impl<const N: usize, T> FixedLenCollection for [T; N] {}
unsafe impl<const N: usize, T> FixedLenCollection for &'_ [T; N] {}
unsafe impl<const N: usize, T> FixedLenCollection for &'_ mut [T; N] {}
unsafe impl FixedLenCollection for str {}