Skip to main content

StreamParams

Struct StreamParams 

Source
#[non_exhaustive]
pub struct StreamParams {
Show 13 fields pub query: Option<String>, pub sources: Option<Vec<String>>, pub exclude_sources: Option<Vec<String>>, pub opt_in_sources: Option<Vec<String>>, pub language: Option<String>, pub tickers: Option<Vec<String>>, pub countries: Option<Vec<String>>, pub categories: Option<Vec<String>>, pub source_types: Option<Vec<SourceType>>, pub exclude_source_types: Option<Vec<SourceType>>, pub exclude_empty_content: Option<bool>, pub include_updates: Option<bool>, pub include: Option<Vec<IncludeBlock>>,
}
Expand description

Subscribe parameters of the enriched stream (client.stream()).

Streams keep the subscription vocabulary: one language, no flat event or role filters (use query, e.g. eventType:mna).

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§query: Option<String>

Query (lenient stream grammar).

§sources: Option<Vec<String>>

Only these source domains.

§exclude_sources: Option<Vec<String>>

Source domains left out.

§opt_in_sources: Option<Vec<String>>

Non-default sources added.

§language: Option<String>

One language (ISO 639-1); the server default is en.

§tickers: Option<Vec<String>>

Tickers.

§countries: Option<Vec<String>>

Story countries.

§categories: Option<Vec<String>>

Categories.

§source_types: Option<Vec<SourceType>>

Only sources of these types. Articles of unclassified sources never match.

§exclude_source_types: Option<Vec<SourceType>>

Source types left out. Articles of unclassified sources are kept.

§exclude_empty_content: Option<bool>

Leave out articles without content.

§include_updates: Option<bool>

Without it the server never sends article.updated.

§include: Option<Vec<IncludeBlock>>

Extra blocks (at most 3).

Implementations§

Source§

impl StreamParams

Source

pub fn new() -> Self

Empty parameters.

Source

pub fn from_json(json: &str) -> Result<Self>

Reads parameters from a JSON object with the wire keys; unknown keys are rejected.

Source

pub fn query(self, value: impl Into<String>) -> Self

Query.

Source

pub fn language(self, value: impl Into<String>) -> Self

One language.

Source

pub fn sources<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Only these source domains.

Source

pub fn exclude_sources<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Source domains left out.

Source

pub fn opt_in_sources<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Non-default sources added.

Source

pub fn tickers<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Tickers.

Source

pub fn countries<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Story countries.

Source

pub fn categories<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Categories.

Source

pub fn source_types<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<SourceType>,

Only sources of these types (SourceType::NEWSWIRE, …).

Source

pub fn exclude_source_types<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<SourceType>,

Source types left out.

Source

pub fn include<I, S>(self, values: I) -> Self
where I: IntoIterator<Item = S>, S: Into<IncludeBlock>,

Extra blocks.

Source

pub fn exclude_empty_content(self, value: bool) -> Self

Leave out articles without content.

Source

pub fn include_updates(self, value: bool) -> Self

Also deliver article.updated.

Trait Implementations§

Source§

impl Clone for StreamParams

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for StreamParams

Source§

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

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

impl Default for StreamParams

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for StreamParams

Source§

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 Eq for StreamParams

Source§

impl PartialEq for StreamParams

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for StreamParams

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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