Skip to main content

ContentFilteredTopic

Struct ContentFilteredTopic 

Source
pub struct ContentFilteredTopic<T: DdsType> { /* private fields */ }
Expand description

ContentFilteredTopic<T> — a sub-topic of a Topic<T> with a filter expression. Spec reference: OMG DDS 1.4 §2.2.2.3.3.

“ContentFilteredTopic is a specialization of TopicDescription that allows for content-based subscriptions. The selection of the content is done using a filter_expression with parameters (filter_parameters).”

The filter expression is a SQL subset (DDS-DCPS Annex B, BNF): field op literal-or-param, AND/OR/NOT composition, parens, LIKE. The concrete parser lives in zerodds-sql-filter.

Lifecycle: the CFT holds a clone of the related topic (shared Arc<TopicInner>) and is itself cloneable. Filter parameters are mutable at runtime (spec §2.2.2.3.3.7).

Implementations§

Source§

impl<T: DdsType> ContentFilteredTopic<T>

Source

pub fn get_filter_expression(&self) -> &str

Spec §2.2.2.3.3.4 get_filter_expression.

Source

pub fn get_filter_parameters(&self) -> Vec<String>

Spec §2.2.2.3.3.5 get_filter_parameters.

Source

pub fn set_filter_parameters(&self, params: Vec<String>) -> Result<()>

Spec §2.2.2.3.3.6 set_filter_parameters. Swaps the parameters (equal count is not enforced — the spec says “should match the number of %n tokens” as a recommendation; we verify it strictly).

§Errors

BadParameter if a %N index is outside the new vec.

Spec §2.2.2.3.3.3 get_related_topic.

Source

pub fn evaluate<R: RowAccess>(&self, row: &R) -> Result<bool>

Evaluates the filter against a decoded sample. Returns Ok(true) if the sample should pass, Ok(false) if it is filtered out, Err if the expression does not fit the row schema (caller’s decision: filter denies or error).

§Errors
  • PreconditionNotMet if the filter-parameter lock is poisoned.
  • BadParameter if a field in the expression does not exist in the row or a type mismatch occurs.

Trait Implementations§

Source§

impl<T: DdsType> Clone for ContentFilteredTopic<T>

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<T: Debug + DdsType> Debug for ContentFilteredTopic<T>

Source§

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

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

impl<T: DdsType> TopicDescription for ContentFilteredTopic<T>

Source§

fn get_type_name(&self) -> &str

The type name comes from the related topic — a CFT shares the schema with the underlying topic.

Source§

fn get_name(&self) -> &str

Topic name (e.g. "ChatterTopic"). Spec §2.2.2.3.1 get_name.
Source§

fn get_participant(&self) -> &DomainParticipant

Owning participant. Spec §2.2.2.3.1 get_participant.

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