Struct yy_typings::utils::ResourceNameValidator
source · [−]pub struct ResourceNameValidator { /* private fields */ }
Expand description
Provides validation services for Gms2 Resource Names by running the Regex
of r"[A-z_]\w+"
over the input. For those who don’t speak Regex, it passes
for any input which contains only A-z
, _
, or 0-9
and which does not
begin with 0-9
.
Passes:
spr_player
_abc
_a12bc
Fails:
0123abc
9_
5
Implementations
sourceimpl ResourceNameValidator
impl ResourceNameValidator
sourcepub fn new() -> ResourceNameValidator
pub fn new() -> ResourceNameValidator
Create a new PathValidator
, and initialize its regex. Use this
stateful struct if you are going to be validating multiple paths. If
only validating one path, feel free to use
PathValidator::validate_path_once
.
sourcepub fn is_valid(&self, input: &str) -> bool
pub fn is_valid(&self, input: &str) -> bool
Checks if the path given is a valid name for Gms2 Resources.
sourcepub fn validate_path_once(input: &str) -> bool
pub fn validate_path_once(input: &str) -> bool
Checks if path is a valid name for Gms2 Resources. It is relatively inefficent, and does one allocations per call.
Trait Implementations
sourceimpl Clone for ResourceNameValidator
impl Clone for ResourceNameValidator
sourcefn clone(&self) -> ResourceNameValidator
fn clone(&self) -> ResourceNameValidator
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ResourceNameValidator
impl Debug for ResourceNameValidator
Auto Trait Implementations
impl RefUnwindSafe for ResourceNameValidator
impl Send for ResourceNameValidator
impl Sync for ResourceNameValidator
impl Unpin for ResourceNameValidator
impl UnwindSafe for ResourceNameValidator
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more