Struct mpd_client::filter::Filter[][src]

pub struct Filter(_);

Implementations

impl Filter[src]

pub fn new(
    tag: Tag,
    operator: Operator,
    value: impl Into<Cow<'static, str>>
) -> Self
[src]

Create a filter which selects on the given tag, using the given operator, for the given value.

See also Tag::any().

use mpd_protocol::command::Argument;
use mpd_client::{Tag, filter::{Filter, Operator}};

assert_eq!(
    Filter::new(Tag::Artist, Operator::Equal, "foo\'s bar\"").render(),
    "(Artist == \"foo\\\'s bar\\\"\")"
);

pub fn tag(tag: Tag, value: impl Into<Cow<'static, str>>) -> Self[src]

Create a filter which checks where the given tag is equal to the given value.

Shorthand method that always checks for equality.

use mpd_protocol::command::Argument;
use mpd_client::{Filter, Tag};

assert_eq!(
    Filter::tag(Tag::Artist, "hello world").render(),
    "(Artist == \"hello world\")"
);

pub fn tag_exists(tag: Tag) -> Self[src]

Create a filter which checks for the existence of tag (with any value).

pub fn tag_absent(tag: Tag) -> Self[src]

Create a filter which checks for the absence of tag.

pub fn negate(self) -> Self[src]

Negate the filter.

You can also use the negation operator (!) if you prefer to negate at the start of an expression.

use mpd_protocol::command::Argument;
use mpd_client::{Filter, Tag};

assert_eq!(
    Filter::tag(Tag::Artist, "hello").negate().render(),
    "(!(Artist == \"hello\"))"
);

pub fn and(self, other: Self) -> Self[src]

Chain the given filter onto this one with an AND.

Automatically flattens nested AND conditions.

use mpd_protocol::command::Argument;
use mpd_client::{Filter, Tag};

assert_eq!(
    Filter::tag(Tag::Artist, "foo").and(Filter::tag(Tag::Album, "bar")).render(),
    "((Artist == \"foo\") AND (Album == \"bar\"))"
);

Trait Implementations

impl Argument for Filter[src]

impl Clone for Filter[src]

impl Debug for Filter[src]

impl Eq for Filter[src]

impl Not for Filter[src]

type Output = Self

The resulting type after applying the ! operator.

impl PartialEq<Filter> for Filter[src]

impl StructuralEq for Filter[src]

impl StructuralPartialEq for Filter[src]

Auto Trait Implementations

impl RefUnwindSafe for Filter

impl Send for Filter

impl Sync for Filter

impl Unpin for Filter

impl UnwindSafe for Filter

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> WithSubscriber for T[src]