[][src]Struct papyrus::code::CrateType

pub struct CrateType {
    pub src_line: String,
    pub cargo_name: String,
}

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 (-).

Implementations

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 Debug for CrateType[src]

impl PartialEq<CrateType> for CrateType[src]

impl StructuralPartialEq for CrateType[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<'a, T> Captures<'a> for T where
    T: ?Sized
[src]

impl<T> Erased for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> MaybeResult<T> for T[src]

type Error = !

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<E> SpecializationError for E[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,