pub struct GoTestName(/* private fields */);Implementations§
Source§impl GoTestName
impl GoTestName
Sourcepub fn new(value: impl AsRef<str>) -> Result<GoTestName, GoTestError>
pub fn new(value: impl AsRef<str>) -> Result<GoTestName, GoTestError>
Creates Go testing name metadata.
§Errors
Returns GoTestError when the name is empty or has the wrong Go testing prefix.
Examples found in repository?
examples/basic_usage.rs (line 9)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let version: GoVersion = "go1.22.0".parse()?;
5 let identifier = GoIdentifier::new("ServeHTTP")?;
6 let package = GoPackageName::new("http")?;
7 let import = GoImportPath::new("net/http")?;
8 let module = GoModulePath::new("example.com/project")?;
9 let test = GoTestName::new("TestHandler")?;
10
11 assert_eq!(version.to_string(), "1.22.0");
12 assert!(identifier.is_exported());
13 assert_eq!(package.as_str(), "http");
14 assert_eq!(import.as_str(), "net/http");
15 assert_eq!(module.as_str(), "example.com/project");
16 assert_eq!(test.as_str(), "TestHandler");
17 Ok(())
18}Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns the testing name.
Examples found in repository?
examples/basic_usage.rs (line 16)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let version: GoVersion = "go1.22.0".parse()?;
5 let identifier = GoIdentifier::new("ServeHTTP")?;
6 let package = GoPackageName::new("http")?;
7 let import = GoImportPath::new("net/http")?;
8 let module = GoModulePath::new("example.com/project")?;
9 let test = GoTestName::new("TestHandler")?;
10
11 assert_eq!(version.to_string(), "1.22.0");
12 assert!(identifier.is_exported());
13 assert_eq!(package.as_str(), "http");
14 assert_eq!(import.as_str(), "net/http");
15 assert_eq!(module.as_str(), "example.com/project");
16 assert_eq!(test.as_str(), "TestHandler");
17 Ok(())
18}Trait Implementations§
Source§impl AsRef<str> for GoTestName
impl AsRef<str> for GoTestName
Source§impl Clone for GoTestName
impl Clone for GoTestName
Source§fn clone(&self) -> GoTestName
fn clone(&self) -> GoTestName
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 GoTestName
impl Debug for GoTestName
Source§impl Display for GoTestName
impl Display for GoTestName
Source§impl FromStr for GoTestName
impl FromStr for GoTestName
Source§type Err = GoTestError
type Err = GoTestError
The associated error which can be returned from parsing.
Source§fn from_str(value: &str) -> Result<GoTestName, <GoTestName as FromStr>::Err>
fn from_str(value: &str) -> Result<GoTestName, <GoTestName as FromStr>::Err>
Parses a string
s to return a value of this type. Read moreSource§impl Hash for GoTestName
impl Hash for GoTestName
Source§impl Ord for GoTestName
impl Ord for GoTestName
Source§fn cmp(&self, other: &GoTestName) -> Ordering
fn cmp(&self, other: &GoTestName) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for GoTestName
impl PartialEq for GoTestName
Source§fn eq(&self, other: &GoTestName) -> bool
fn eq(&self, other: &GoTestName) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for GoTestName
impl PartialOrd for GoTestName
Source§impl TryFrom<&str> for GoTestName
impl TryFrom<&str> for GoTestName
Source§type Error = GoTestError
type Error = GoTestError
The type returned in the event of a conversion error.
Source§fn try_from(
value: &str,
) -> Result<GoTestName, <GoTestName as TryFrom<&str>>::Error>
fn try_from( value: &str, ) -> Result<GoTestName, <GoTestName as TryFrom<&str>>::Error>
Performs the conversion.
impl Eq for GoTestName
impl StructuralPartialEq for GoTestName
Auto Trait Implementations§
impl Freeze for GoTestName
impl RefUnwindSafe for GoTestName
impl Send for GoTestName
impl Sync for GoTestName
impl Unpin for GoTestName
impl UnsafeUnpin for GoTestName
impl UnwindSafe for GoTestName
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