Struct check_latest::Versions [−][src]
pub struct Versions { /* fields omitted */ }
Expand description
A collection of Version
s.
Implementations
impl Versions
[src]
impl Versions
[src]pub async fn async_new(crate_name: &str, user_agent: &str) -> Result<Versions>
[src]
pub async fn async_new(crate_name: &str, user_agent: &str) -> Result<Versions>
[src]crate_name
: The crate that the version should be checked for.user_agent
: without a proper User-Agent, the request to the Crates.io API will result in the response below, which we won’t be able to parse into crate versions.
Example Response from Bad User Agent
We require that all requests include a `User-Agent` header. To allow us to determine the impact your bot has on our service, we ask that your user agent actually identify your bot, and not just report the HTTP client library you're using. Including contact information will also reduce the chance that we will need to take action against your bot.
Bad:
User-Agent: <bad user agent that you used>
Better:
User-Agent: my_crawler
Best:
User-Agent: my_crawler (my_crawler.com/info)
User-Agent: my_crawler (help@my_crawler.com)
If you believe you've received this message in error, please email help@crates.io and include the request id {}.
Example
use check_latest::Versions; if let Ok(versions) = Versions::async_new("my-awesome-crate-bin", "my-awesome-crate-bin/1.0.0").await { /* Do your stuff */ }
impl Versions
[src]
impl Versions
[src]pub fn new(crate_name: &str, user_agent: &str) -> Result<Versions>
[src]
pub fn new(crate_name: &str, user_agent: &str) -> Result<Versions>
[src]crate_name
: The crate that the version should be checked for.user_agent
: without a proper User-Agent, the request to the Crates.io API will result in the response below, which we won’t be able to parse into crate versions.
Example Response from Bad User Agent
We require that all requests include a `User-Agent` header. To allow us to determine the impact your bot has on our service, we ask that your user agent actually identify your bot, and not just report the HTTP client library you're using. Including contact information will also reduce the chance that we will need to take action against your bot.
Bad:
User-Agent: <bad user agent that you used>
Better:
User-Agent: my_crawler
Best:
User-Agent: my_crawler (my_crawler.com/info)
User-Agent: my_crawler (help@my_crawler.com)
If you believe you've received this message in error, please email help@crates.io and include the request id {}.
Example
use check_latest::Versions; if let Ok(versions) = Versions::new("my-awesome-crate-bin", "my-awesome-crate-bin/1.0.0") { /* Do your stuff */ }
impl Versions
[src]
impl Versions
[src]pub fn max_version(&self) -> Option<&Version>
[src]
pub fn max_version(&self) -> Option<&Version>
[src]Gets any max version.
Example
use check_latest::Versions; let newest = Versions::new("my-cool-crate", "my-cool-crate/1.0.0") .unwrap() .max_version();
pub fn max_unyanked_version(&self) -> Option<&Version>
[src]
pub fn max_unyanked_version(&self) -> Option<&Version>
[src]Gets the max version that hasn’t been yanked.
Example
use check_latest::Versions; let newest = Versions::new("my-cool-crate", "my-cool-crate/1.0.0") .unwrap() .max_unyanked_version();
pub fn max_yanked_version(&self) -> Option<&Version>
[src]
pub fn max_yanked_version(&self) -> Option<&Version>
[src]Gets max version that has been yanked.
Example
use check_latest::Versions; let newest = Versions::new("my-cool-crate", "my-cool-crate/1.0.0") .unwrap() .newest_yanked_version();
pub fn max_minor_version(&self, major: u64) -> Option<&Version>
[src]
pub fn max_minor_version(&self, major: u64) -> Option<&Version>
[src]Gets any max version with the same major version.
For example, if major
= 1, then 1.0.0 <= max_minor_version < 2.0.0
.
Example
use check_latest::Versions; let newest = Versions::new("my-cool-crate", "my-cool-crate/1.0.0") .unwrap() .max_minor_version(1);
pub fn max_unyanked_minor_version(&self, major: u64) -> Option<&Version>
[src]
pub fn max_unyanked_minor_version(&self, major: u64) -> Option<&Version>
[src]Gets the max version that hasn’t been yanked with the same major version.
For example, if major
= 1, then 1.0.0 <= max_minor_version < 2.0.0
.
Example
use check_latest::Versions; let newest = Versions::new("my-cool-crate", "my-cool-crate/1.0.0") .unwrap() .max_unyanked_minor_version(1);
pub fn max_yanked_minor_version(&self, major: u64) -> Option<&Version>
[src]
pub fn max_yanked_minor_version(&self, major: u64) -> Option<&Version>
[src]Gets max version that has been yanked with the same major version.
For example, if major
= 1, then 1.0.0 <= max_minor_version < 2.0.0
.
Example
use check_latest::Versions; let newest = Versions::new("my-cool-crate", "my-cool-crate/1.0.0") .unwrap() .max_yanked_minor_version(1);
pub fn max_patch(&self, major: u64, minor: u64) -> Option<&Version>
[src]
pub fn max_patch(&self, major: u64, minor: u64) -> Option<&Version>
[src]Gets any max version with the same major and minor version.
For example, if major
= 1 and minor
= 2,
then 1.2.0 <= max_patch < 1.3.0
.
Example
use check_latest::Versions; let newest = Versions::new("my-cool-crate", "my-cool-crate/1.0.0") .unwrap() .max_patch(1, 2);
pub fn max_unyanked_patch(&self, major: u64, minor: u64) -> Option<&Version>
[src]
pub fn max_unyanked_patch(&self, major: u64, minor: u64) -> Option<&Version>
[src]Gets the max version that hasn’t been yanked with the same major and minor version.
For example, if major
= 1 and minor
= 2,
then 1.2.0 <= max_patch < 1.3.0
.
Example
use check_latest::Versions; let newest = Versions::new("my-cool-crate", "my-cool-crate/1.0.0") .unwrap() .max_unyanked_patch(1, 2);
pub fn max_yanked_patch(&self, major: u64, minor: u64) -> Option<&Version>
[src]
pub fn max_yanked_patch(&self, major: u64, minor: u64) -> Option<&Version>
[src]Gets max version that has been yanked with the same major and minor version.
For example, if major
= 1 and minor
= 2,
then 1.2.0 <= max_patch < 1.3.0
.
Example
use check_latest::Versions; let newest = Versions::new("my-cool-crate", "my-cool-crate/1.0.0") .unwrap() .max_yanked_patch(1, 2);
pub fn newest_version(&self) -> Option<&Version>
[src]
pub fn newest_version(&self) -> Option<&Version>
[src]Gets any newest version.
Example
use check_latest::Versions; let newest = Versions::new("my-cool-crate", "my-cool-crate/1.0.0") .unwrap() .newest_version();
pub fn newest_unyanked_version(&self) -> Option<&Version>
[src]
pub fn newest_unyanked_version(&self) -> Option<&Version>
[src]Gets the newest version that hasn’t been yanked.
Example
use check_latest::Versions; let newest = Versions::new("my-cool-crate", "my-cool-crate/1.0.0") .unwrap() .newest_unyanked_version();
pub fn newest_yanked_version(&self) -> Option<&Version>
[src]
pub fn newest_yanked_version(&self) -> Option<&Version>
[src]Gets newest version that has been yanked.
Example
use check_latest::Versions; let newest = Versions::new("my-cool-crate", "my-cool-crate/1.0.0") .unwrap() .newest_yanked_version();
pub fn versions_mut(&mut self) -> &mut Vec<Version>
[src]
pub fn versions_mut(&mut self) -> &mut Vec<Version>
[src]Gets a mutable list of versions that were found.
pub fn versions_owned(self) -> Vec<Version>
[src]
pub fn versions_owned(self) -> Vec<Version>
[src]Takes ownership of self
and returns owned versions list.
Trait Implementations
impl<'de> Deserialize<'de> for Versions
[src]
impl<'de> Deserialize<'de> for Versions
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Versions
impl Send for Versions
impl Sync for Versions
impl Unpin for Versions
impl UnwindSafe for Versions
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,