[−][src]Struct papyrus::code::CrateType
Some definition around crate names.
Crates are parsed and made suitable for Cargo.toml
. The input line is kept verbatim.
Examples
let input = "extern crate a_crate as acrate;"; let cr = CrateType::parse_str(input).unwrap(); assert_eq!(&cr.src_line, input); assert_eq!(&cr.cargo_name, "a-crate");
Fields
src_line: String
The source line which adds the crates.
This is usually extern crate crate_name;
or could be extern crate crate_name as alias;
cargo_name: String
The name to use in cargo.
Usually crate_name
will turn into crate-name
. The default behaviour is to replace _
with a dash (-
).
Methods
impl CrateType
[src]
pub fn parse_str(string: &str) -> Result<Self, &'static str>
[src]
Parses a string to return the CrateType
.
Trait Implementations
impl Clone for CrateType
[src]
impl PartialEq<CrateType> for CrateType
[src]
impl Debug for CrateType
[src]
Auto Trait Implementations
impl Send for CrateType
impl Unpin for CrateType
impl Sync for CrateType
impl UnwindSafe for CrateType
impl RefUnwindSafe for CrateType
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,