pub enum ScriptName {
Anonymous(u32),
Named(ConcreteScriptName),
}
Variants§
Anonymous(u32)
Named(ConcreteScriptName)
Implementations§
Source§impl ScriptName
impl ScriptName
pub fn valid( s: &str, allow_endwith_slash: bool, allow_dot: bool, check: bool, ) -> Result<Option<u32>>
pub fn namespaces(&self) -> Vec<&str>
pub fn is_anonymous(&self) -> bool
pub fn key(&self) -> Cow<'_, str>
Sourcepub fn to_file_path(&self, ty: &ScriptType) -> Result<PathBuf>
pub fn to_file_path(&self, ty: &ScriptType) -> Result<PathBuf>
回傳值是相對於 HS_HOME 的路徑
Sourcepub fn to_file_path_fallback(&self, ty: &ScriptType) -> (PathBuf, Option<Error>)
pub fn to_file_path_fallback(&self, ty: &ScriptType) -> (PathBuf, Option<Error>)
回傳值是相對於 HS_HOME 的路徑,對未知的類別直接用類別名作擴展名
Trait Implementations§
Source§impl Clone for ScriptName
impl Clone for ScriptName
Source§fn clone(&self) -> ScriptName
fn clone(&self) -> ScriptName
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ScriptName
impl Debug for ScriptName
Source§impl Display for ScriptName
impl Display for ScriptName
Source§impl FromStr for ScriptName
use hyper_scripter::script::*;
let name: ScriptName = ".42".parse().unwrap();
assert_eq!(name, ScriptName::Anonymous(42));
let name: ScriptName = "name".parse().unwrap();
assert_eq!(name.to_string(), "name");
let res: Result<ScriptName, _> = ".0".parse();
res.unwrap_err();
impl FromStr for ScriptName
use hyper_scripter::script::*;
let name: ScriptName = ".42".parse().unwrap();
assert_eq!(name, ScriptName::Anonymous(42));
let name: ScriptName = "name".parse().unwrap();
assert_eq!(name.to_string(), "name");
let res: Result<ScriptName, _> = ".0".parse();
res.unwrap_err();
Source§type Err = DisplayError
type Err = DisplayError
The associated error which can be returned from parsing.
Source§impl Hash for ScriptName
impl Hash for ScriptName
Source§impl IntoScriptName for ScriptName
impl IntoScriptName for ScriptName
fn into_script_name(self) -> Result<ScriptName>
fn into_script_name_unchecked(self) -> Result<ScriptName>where
Self: Sized,
Source§impl Ord for ScriptName
impl Ord for ScriptName
Source§impl PartialEq for ScriptName
impl PartialEq for ScriptName
Source§impl PartialOrd for ScriptName
impl PartialOrd for ScriptName
impl Eq for ScriptName
impl StructuralPartialEq for ScriptName
Auto Trait Implementations§
impl Freeze for ScriptName
impl RefUnwindSafe for ScriptName
impl Send for ScriptName
impl Sync for ScriptName
impl Unpin for ScriptName
impl UnwindSafe for ScriptName
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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