Struct Boundary
struct Boundary { ... }
How an identifier is split into words.
Some boundaries, HYPHEN, UNDERSCORE, and SPACE, consume the character they
split on, whereas the other boundaries do not.
Boundary includes methods that return useful groups of boundaries. It also
contains the defaults_from method which will generate a subset
of default boundaries based on the boundaries present in a string.
You can also create custom delimiter boundaries using the from_delim
method or directly instantiate Boundary for complex boundary conditions.
use ;
assert_eq!;
let conv = new
.set_boundaries
.to_case;
assert_eq!;
Fields
name: &'static strA unique name used for comparison.
condition: fn(_: &[&str], _: Option<&'static str>) -> boolA function that determines if this boundary is present at the start of the string. Second argument is the
argfield.arg: Option<&'static str>An optional string passed to
conditionat runtime. Used internally forBoundary::from_delimmethod.start: usizeWhere the beginning of the boundary is.
len: usizeThe length of the boundary. This is the number of graphemes that are removed when splitting.
Implementations
impl Boundary
const fn from_delim(delim: &'static str) -> BoundaryCreate a new boundary based on a delimiter.
# use ; let conv = new .set_boundaries .to_case; assert_eq!const fn defaults() -> [Boundary; 9]The default list of boundaries used when
Casing::to_caseis called directly and in aConvertergenerated fromConverter::new().# use Boundary; assert_eq!;const fn digits() -> [Boundary; 4]Returns the boundaries that involve digits.
LowerDigit.# use Boundary; assert_eq!;const fn letter_digit() -> [Boundary; 2]Returns the boundaries that are letters followed by digits.
# use Boundary; assert_eq!;fn digit_letter() -> [Boundary; 2]Returns the boundaries that are digits followed by letters.
# use Boundary; assert_eq!;fn defaults_from(pattern: &str) -> Vec<Boundary>Returns a list of all boundaries that are identified within the given string. Could be a short of writing out all the boundaries in a list directly. This will not identify boundary
UpperLowerif it also used as part ofAcronym.If you want to be very explicit and not overlap boundaries, it is recommended to use a colon character.
# use Boundary; assert_eq!; assert_eq!;
impl Clone for Boundary
fn clone(self: &Self) -> Boundary
impl Copy for Boundary
impl Debug for Boundary
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Eq for Boundary
impl Freeze for Boundary
impl Hash for Boundary
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)
impl PartialEq for Boundary
fn eq(self: &Self, other: &Self) -> bool
impl RefUnwindSafe for Boundary
impl Send for Boundary
impl Sync for Boundary
impl Unpin for Boundary
impl UnsafeUnpin for Boundary
impl UnwindSafe for Boundary
impl<T> Any for Boundary
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Boundary
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Boundary
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Boundary
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for Boundary
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Boundary
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for Boundary
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Boundary
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Boundary
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>