[][src]Trait activitystreams_new::activity::QuestionExt

pub trait QuestionExt: AsQuestion {
    fn one_of(&self) -> Option<&OneOrMany<AnyBase>> { ... }
fn set_one_of<T>(&mut self, one_of: T) -> &mut Self
    where
        T: Into<AnyBase>
, { ... }
fn set_many_one_ofs<I, T>(&mut self, items: I) -> &mut Self
    where
        I: IntoIterator<Item = T>,
        T: Into<AnyBase>
, { ... }
fn add_one_of<T>(&mut self, one_of: T) -> &mut Self
    where
        T: Into<AnyBase>
, { ... }
fn take_one_of(&mut self) -> Option<OneOrMany<AnyBase>> { ... }
fn delete_one_of(&mut self) -> &mut Self { ... }
fn any_of(&self) -> Option<&OneOrMany<AnyBase>> { ... }
fn set_any_of<T>(&mut self, any_of: T) -> &mut Self
    where
        T: Into<AnyBase>
, { ... }
fn set_many_any_ofs<I, T>(&mut self, items: I) -> &mut Self
    where
        I: IntoIterator<Item = T>,
        T: Into<AnyBase>
, { ... }
fn add_any_of<T>(&mut self, any_of: T) -> &mut Self
    where
        T: Into<AnyBase>
, { ... }
fn take_any_of(&mut self) -> Option<OneOrMany<AnyBase>> { ... }
fn delete_any_of(&mut self) -> &mut Self { ... } }

Helper methods for interacting with Question types

This trait represents methods valid for an ActivityStreams Question

Documentation for the fields related to these methods can be found on the Question struct

Provided methods

fn one_of(&self) -> Option<&OneOrMany<AnyBase>>

Fetch the one_of field for the current activity

use activitystreams_new::prelude::*;

if let Some(one_of) = question.one_of() {
    println!("{:?}", one_of);
}

fn set_one_of<T>(&mut self, one_of: T) -> &mut Self where
    T: Into<AnyBase>, 

Set the one_of field for the current activity

This overwrites the contents of one_of

use activitystreams_new::prelude::*;

question.set_one_of(uri!("https://example.com"));

fn set_many_one_ofs<I, T>(&mut self, items: I) -> &mut Self where
    I: IntoIterator<Item = T>,
    T: Into<AnyBase>, 

Set many one_of items for the current activity

This overwrites the contents of one_of

use activitystreams_new::prelude::*;

question.set_many_one_ofs(vec![
    uri!("https://example.com/one"),
    uri!("https://example.com/two"),
]);

fn add_one_of<T>(&mut self, one_of: T) -> &mut Self where
    T: Into<AnyBase>, 

Add a one_of to the current activity

This does not overwrite the contents of one_of, only appends an item

use activitystreams_new::prelude::*;

question
    .add_one_of(uri!("https://example.com/one"))
    .add_one_of(uri!("https://example.com/two"));

fn take_one_of(&mut self) -> Option<OneOrMany<AnyBase>>

Take the one_of field from the current activity, leaving nothing

use activitystreams_new::prelude::*;

if let Some(one_of) = question.take_one_of() {
    println!("{:?}", one_of);
}

fn delete_one_of(&mut self) -> &mut Self

Delete the one_of field from the current activity

use activitystreams_new::prelude::*;

assert!(question.one_of().is_some());
question.delete_one_of();
assert!(question.one_of().is_none());

fn any_of(&self) -> Option<&OneOrMany<AnyBase>>

Fetch the any_of field for the current activity

use activitystreams_new::prelude::*;

if let Some(any_of) = question.any_of() {
    println!("{:?}", any_of);
}

fn set_any_of<T>(&mut self, any_of: T) -> &mut Self where
    T: Into<AnyBase>, 

Set the any_of field for the current activity

This overwrites the contents of any_of

use activitystreams_new::prelude::*;

question.set_any_of(uri!("https://example.com"));

fn set_many_any_ofs<I, T>(&mut self, items: I) -> &mut Self where
    I: IntoIterator<Item = T>,
    T: Into<AnyBase>, 

Set many any_of items for the current activity

This overwrites the contents of any_of

use activitystreams_new::prelude::*;

question.set_many_any_ofs(vec![
    uri!("https://example.com/one"),
    uri!("https://example.com/two"),
]);

fn add_any_of<T>(&mut self, any_of: T) -> &mut Self where
    T: Into<AnyBase>, 

Add an any_of to the current activity

This does not overwrite the contents of any_of, only appends an item

use activitystreams_new::prelude::*;

question
    .add_any_of(uri!("https://example.com/one"))
    .add_any_of(uri!("https://example.com/two"));

fn take_any_of(&mut self) -> Option<OneOrMany<AnyBase>>

Take the any_of field from the current activity, leaving nothing

use activitystreams_new::prelude::*;

if let Some(any_of) = question.take_any_of() {
    println!("{:?}", any_of);
}

fn delete_any_of(&mut self) -> &mut Self

Delete the any_of field from the current activity

use activitystreams_new::prelude::*;

assert!(question.any_of().is_some());
question.delete_any_of();
assert!(question.any_of().is_none());
Loading content...

Implementors

impl<T> QuestionExt for T where
    T: AsQuestion
[src]

Loading content...