pub struct FileNumber { /* private fields */ }Expand description
Extracts an ascii-digit number from file names.
Defines number:
- by default: as first ascii-digit subsequence.
- after
FileNumber::update: as first different ascii-digit subsequence between two names OR by default (if not different ascii-digit subsequence).
§Limits
Correct works with standard path length only (255 ascii-digits max). In other cases, processes first 255 ascii-digits only.
Implementations§
Source§impl FileNumber
impl FileNumber
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns the number string if present; otherwise, returns an empty string.
Sourcepub fn from_bytes<B>(bytes: &B) -> FileNumber
pub fn from_bytes<B>(bytes: &B) -> FileNumber
Constructs a new FileNumber from a byte slice.
Sets number as first ascii-digit subsequence (if present); otherwise, as empty string.
Sourcepub fn update<B>(&mut self, new: &B)
pub fn update<B>(&mut self, new: &B)
Updates the number from new bytes.
§Cases
-
New bytes contain correct and different number at the old address: copies only this number bytes.
-
New bytes contain correct and different number at the any other old address: copies this number bytes and updates index number.
-
Otherwise, its eq constructs new
FileNumber.
Trait Implementations§
Source§impl Clone for FileNumber
impl Clone for FileNumber
Source§impl From<&OsStr> for FileNumber
impl From<&OsStr> for FileNumber
Auto Trait Implementations§
impl Forget for FileNumber
impl Freeze for FileNumber
impl Move for FileNumber
impl RefUnwindSafe for FileNumber
impl Send for FileNumber
impl Sync for FileNumber
impl Unpin for FileNumber
impl UnsafeUnpin for FileNumber
impl UnwindSafe for FileNumber
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more