Constraint

Enum Constraint 

Source
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

Source

pub fn path(pattern: &str) -> Result<Self, GlobError>

Match the given runtime’s bindir against this glob pattern.

The syntax comes from the globset crate. However, here we deviate from its default rules:

  • * and ? do not match path separators (/); use ** for that.
  • empty alternators, e.g. {,.rs} are allowed.

Use glob if you want to select your own rules.

Source

pub fn glob(glob: &Glob) -> Self

Match the given runtime’s bindir against this glob.

Source

pub fn version(version: &str) -> Result<Self, VersionError>

Match the given runtime against this version.

Source

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.

Source

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.

Source

pub fn matches(&self, runtime: &Runtime) -> bool

Does the given runtime match this constraint?

Trait Implementations§

Source§

impl BitAnd for Constraint

Source§

fn bitand(self, rhs: Self) -> Self::Output

Match both the constraints.

Source§

type Output = Constraint

The resulting type after applying the & operator.
Source§

impl BitOr for Constraint

Source§

fn bitor(self, rhs: Self) -> Self::Output

Match either of the constraints.

Source§

type Output = Constraint

The resulting type after applying the | operator.
Source§

impl Clone for Constraint

Source§

fn clone(&self) -> Constraint

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Constraint

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<PartialVersion> for Constraint

Source§

fn from(version: PartialVersion) -> Self

Source§

impl FromStr for Constraint

Source§

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

The associated error which can be returned from parsing.
Source§

impl Not for Constraint

Source§

fn not(self) -> Self::Output

Invert this constraint.

Source§

type Output = Constraint

The resulting type after applying the ! operator.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> QuoteExt for T
where T: ?Sized,

Source§

fn push_quoted<'q, Q, S>(&mut self, _q: Q, s: S)
where Q: QuoteInto<T>, S: Into<Quotable<'q>>,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,