pub enum Constraint {
BinDir(GlobMatcher),
Version(PartialVersion),
Either(Box<Constraint>, Box<Constraint>),
Both(Box<Constraint>, Box<Constraint>),
Not(Box<Constraint>),
Anything,
Nothing,
}
Expand description
A constraint used when selecting a PostgreSQL runtime.
Variants§
BinDir(GlobMatcher)
Match the runtime’s bindir
.
Version(PartialVersion)
Match the given version.
Either(Box<Constraint>, Box<Constraint>)
Either constraint can be satisfied.
Both(Box<Constraint>, Box<Constraint>)
Both constraints must be satisfied.
Not(Box<Constraint>)
Invert the given constraint; use !constraint
for the same effect.
Anything
Match any runtime.
Nothing
Match no runtimes at all.
Implementations§
Source§impl Constraint
impl Constraint
Sourcepub fn version(version: &str) -> Result<Self, VersionError>
pub fn version(version: &str) -> Result<Self, VersionError>
Match the given runtime against this version.
Sourcepub fn any<C: IntoIterator<Item = Constraint>>(constraints: C) -> Self
pub fn any<C: IntoIterator<Item = Constraint>>(constraints: C) -> Self
Match any of the given constraints.
If there are no constraints, this returns Self::Nothing
.
Sourcepub fn all<C: IntoIterator<Item = Constraint>>(constraints: C) -> Self
pub fn all<C: IntoIterator<Item = Constraint>>(constraints: C) -> Self
Match all of the given constraints.
If there are no constraints, this returns Self::Anything
.
Trait Implementations§
Source§impl BitAnd for Constraint
impl BitAnd for Constraint
Source§impl BitOr for Constraint
impl BitOr for Constraint
Source§impl Clone for Constraint
impl Clone for Constraint
Source§fn clone(&self) -> Constraint
fn clone(&self) -> Constraint
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 Constraint
impl Debug for Constraint
Source§impl From<PartialVersion> for Constraint
impl From<PartialVersion> for Constraint
Source§fn from(version: PartialVersion) -> Self
fn from(version: PartialVersion) -> Self
Convert a PartialVersion
into a Constraint::Version
.
Source§impl FromStr for Constraint
impl FromStr for Constraint
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Parse a constraint from a string.
If it contains a path separator, it will be parsed as a glob pattern, otherwise it will be parsed as a version constraint.
Source§type Err = ConstraintError
type Err = ConstraintError
The associated error which can be returned from parsing.
Auto Trait Implementations§
impl Freeze for Constraint
impl RefUnwindSafe for Constraint
impl Send for Constraint
impl Sync for Constraint
impl Unpin for Constraint
impl UnwindSafe for Constraint
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<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 more