pub struct PackageReq { /* private fields */ }Expand description
A lua package requirement with a name and an optional version requirement.
Implementations§
Source§impl PackageReq
impl PackageReq
pub fn new( name: String, version: Option<String>, ) -> Result<Self, PackageVersionReqError>
Sourcepub unsafe fn new_unchecked(name: String, version: Option<String>) -> Self
pub unsafe fn new_unchecked(name: String, version: Option<String>) -> Self
§Safety
Call this only if you are absolutely sure that a PackageReq can be parsed from the arguments.
Calling this with invalid arguments is undefined behaviour.
pub fn parse(pkg_constraints: &str) -> Result<Self, PackageReqParseError>
pub fn name(&self) -> &PackageName
pub fn version_req(&self) -> &PackageVersionReq
Sourcepub fn matches(&self, package: &PackageSpec) -> bool
pub fn matches(&self, package: &PackageSpec) -> bool
Evaluate whether the given package satisfies the package requirement
given by self.
Trait Implementations§
Source§impl Clone for PackageReq
impl Clone for PackageReq
Source§fn clone(&self) -> PackageReq
fn clone(&self) -> PackageReq
Returns a duplicate of the value. Read more
1.0.0 · 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 PackageReq
impl Debug for PackageReq
Source§impl<'de> Deserialize<'de> for PackageReq
impl<'de> Deserialize<'de> for PackageReq
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for PackageReq
impl Display for PackageReq
Source§impl From<PackageName> for PackageReq
impl From<PackageName> for PackageReq
Source§fn from(name: PackageName) -> Self
fn from(name: PackageName) -> Self
Converts to this type from the input type.
Source§impl From<PackageReq> for LuaDependencySpec
impl From<PackageReq> for LuaDependencySpec
Source§fn from(package_req: PackageReq) -> Self
fn from(package_req: PackageReq) -> Self
Converts to this type from the input type.
Source§impl From<PackageSpec> for PackageReq
impl From<PackageSpec> for PackageReq
Source§fn from(value: PackageSpec) -> Self
fn from(value: PackageSpec) -> Self
Converts to this type from the input type.
Source§impl FromLua for PackageReq
impl FromLua for PackageReq
Source§impl FromStr for PackageReq
impl FromStr for PackageReq
Source§impl Hash for PackageReq
impl Hash for PackageReq
Source§impl PartialEq for PackageReq
impl PartialEq for PackageReq
Source§impl TryFrom<PackageReq> for PackageSpec
impl TryFrom<PackageReq> for PackageSpec
Source§type Error = PackageSpecFromPackageReqError
type Error = PackageSpecFromPackageReqError
The type returned in the event of a conversion error.
Source§impl UserData for PackageReq
impl UserData for PackageReq
Source§fn add_methods<M: UserDataMethods<Self>>(methods: &mut M)
fn add_methods<M: UserDataMethods<Self>>(methods: &mut M)
Adds custom methods and operators specific to this userdata.
Source§fn add_fields<F>(fields: &mut F)where
F: UserDataFields<Self>,
fn add_fields<F>(fields: &mut F)where
F: UserDataFields<Self>,
Adds custom fields specific to this userdata.
Source§fn register(registry: &mut UserDataRegistry<Self>)
fn register(registry: &mut UserDataRegistry<Self>)
Registers this type for use in Lua. Read more
impl Eq for PackageReq
impl StructuralPartialEq for PackageReq
Auto Trait Implementations§
impl Freeze for PackageReq
impl RefUnwindSafe for PackageReq
impl Send for PackageReq
impl Sync for PackageReq
impl Unpin for PackageReq
impl UnwindSafe for PackageReq
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> FromLuaMulti for Twhere
T: FromLua,
impl<T> FromLuaMulti for Twhere
T: FromLua,
Source§fn from_lua_multi(values: MultiValue, lua: &Lua) -> Result<T, Error>
fn from_lua_multi(values: MultiValue, lua: &Lua) -> Result<T, Error>
Performs the conversion. Read more
fn from_lua_args( args: MultiValue, i: usize, to: Option<&str>, lua: &Lua, ) -> Result<T, Error>
unsafe fn from_stack_multi(nvals: i32, lua: &RawLua) -> Result<T, Error>
unsafe fn from_stack_args( nargs: i32, i: usize, to: Option<&str>, lua: &RawLua, ) -> Result<T, Error>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoLuaMulti for Twhere
T: IntoLua,
impl<T> IntoLuaMulti for Twhere
T: IntoLua,
Source§fn into_lua_multi(self, lua: &Lua) -> Result<MultiValue, Error>
fn into_lua_multi(self, lua: &Lua) -> Result<MultiValue, Error>
Performs the conversion.
unsafe fn push_into_stack_multi(self, lua: &RawLua) -> Result<i32, Error>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
Source§impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
Source§fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
Invokes
WrappingSpan::make_wrapped to wrap an AST node in a span.Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.