Struct browserslist::Distrib[][src]

pub struct Distrib(_, _);
Expand description

Representation of browser name (or node) and its version.

When converting it to string, it will be formatted as the output of browserslist. For example:

use browserslist::Distrib;

assert_eq!(Distrib::new("firefox", "93").to_string(), "firefox 93".to_string());
assert_eq!(Distrib::new("op_mini", "all").to_string(), "op_mini all".to_string());
assert_eq!(Distrib::new("node", "16.0.0").to_string(), "node 16.0.0".to_string());

Implementations

Create a new distribution with browser name (or node) and version.

Return browser name, or node.

use browserslist::Distrib;

assert_eq!(Distrib::new("firefox", "93").name(), "firefox");
assert_eq!(Distrib::new("op_mini", "all").name(), "op_mini");
assert_eq!(Distrib::new("node", "16.0.0").name(), "node");

Return version string.

use browserslist::Distrib;

assert_eq!(Distrib::new("firefox", "93").version(), "93");
assert_eq!(Distrib::new("op_mini", "all").version(), "all");
assert_eq!(Distrib::new("node", "16.0.0").version(), "16.0.0");

Trait Implementations

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.