Enum hyper_scripter::script::ScriptName
source · 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
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();
§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§fn eq(&self, other: &ScriptName) -> bool
fn eq(&self, other: &ScriptName) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for ScriptName
impl PartialOrd for ScriptName
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for ScriptName
impl StructuralEq for ScriptName
impl StructuralPartialEq for ScriptName
Auto Trait Implementations§
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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.