pub trait QuestionExt: AsQuestion {
Show 20 methods 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 { ... } fn closed(
        &self
    ) -> Option<Either<&OneOrMany<AnyBase>, Either<OffsetDateTime, bool>>> { ... } fn set_closed_base<T>(&mut self, closed: T) -> &mut Self
    where
        T: Into<AnyBase>
, { ... } fn set_many_closed_bases<I, T>(&mut self, closed: I) -> &mut Self
    where
        I: IntoIterator<Item = T>,
        T: Into<AnyBase>
, { ... } fn set_closed_date(&mut self, closed: OffsetDateTime) -> &mut Self { ... } fn set_closed_bool(&mut self, closed: bool) -> &mut Self { ... } fn add_closed_base<T>(&mut self, closed: T) -> &mut Self
    where
        T: Into<AnyBase>
, { ... } fn take_closed(
        &mut self
    ) -> Option<Either<OneOrMany<AnyBase>, Either<OffsetDateTime, bool>>> { ... } fn delete_closed(&mut self) -> &mut Self { ... }
}
Expand description

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§

Fetch the one_of field for the current activity

use activitystreams::prelude::*;

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

Set the one_of field for the current activity

This overwrites the contents of one_of

use activitystreams::prelude::*;

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

Set many one_of items for the current activity

This overwrites the contents of one_of

use activitystreams::prelude::*;

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

Add a one_of to the current activity

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

use activitystreams::prelude::*;

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

Take the one_of field from the current activity, leaving nothing

use activitystreams::prelude::*;

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

Delete the one_of field from the current activity

use activitystreams::prelude::*;

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

Fetch the any_of field for the current activity

use activitystreams::prelude::*;

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

Set the any_of field for the current activity

This overwrites the contents of any_of

use activitystreams::prelude::*;

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

Set many any_of items for the current activity

This overwrites the contents of any_of

use activitystreams::prelude::*;

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

Add an any_of to the current activity

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

use activitystreams::prelude::*;

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

Take the any_of field from the current activity, leaving nothing

use activitystreams::prelude::*;

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

Delete the any_of field from the current activity

use activitystreams::prelude::*;

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

Fetch the closed field for the current activity

use activitystreams::prelude::*;

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

Set the closed field for the current activity

This overwrites the contents of any_of

use activitystreams::prelude::*;

question.set_closed_base(iri!("https://example.com/one"));

Set many closed items for the current activity

This overwrites the contents of any_of

use activitystreams::prelude::*;

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

Set the closed field as a date

This overwrites the contents of any_of

use activitystreams::prelude::*;

question.set_closed_date(time::OffsetDateTime::now_utc());

Set the closed field as a boolean

This overwrites the contents of any_of

use activitystreams::prelude::*;

question.set_closed_bool(true);

Add an object or link to the closed field

This overwrites the contents of any_of

use activitystreams::prelude::*;

question
    .add_closed_base(iri!("https://example.com/one"))
    .add_closed_base(iri!("https://example.com/two"));

Take the closed field from the current activity

use activitystreams::prelude::*;

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

Remove the closed field from the current activity

use activitystreams::prelude::*;

assert!(question.closed().is_some());
question.delete_closed();
assert!(question.closed().is_none());

Implementors§