Struct spaceapi::StatusBuilder

source ·
pub struct StatusBuilder { /* private fields */ }
Expand description

Builder for the Status object.

Implementations§

source§

impl StatusBuilder

source

pub fn new<S: Into<String>>(space_name: S) -> StatusBuilder

source

pub fn v0_13<S: Into<String>>(space_name: S) -> StatusBuilder

source

pub fn v14<S: Into<String>>(space_name: S) -> StatusBuilder

source

pub fn mixed<S: Into<String>>(space_name: S) -> StatusBuilder

Examples found in repository?
examples/serialization.rs (line 4)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
fn main() {
    let status = StatusBuilder::mixed("coredump")
        .logo("https://www.coredump.ch/logo.png")
        .url("https://www.coredump.ch/")
        .location(Location {
            address: None,
            lat: 47.22936,
            lon: 8.82949,
            ..Default::default()
        })
        .contact(Contact {
            irc: Some("irc://freenode.net/#coredump".into()),
            twitter: Some("@coredump_ch".into()),
            foursquare: Some("525c20e5498e875d8231b1e5".into()),
            email: Some("danilo@coredump.ch".into()),
            ..Default::default()
        })
        .add_issue_report_channel(IssueReportChannel::Email)
        .add_issue_report_channel(IssueReportChannel::Twitter)
        .add_extension("ccc", "chaostreff")
        .state(State::default())
        .build()
        .expect("Creating status failed");
    let stringstatus = serde_json::to_string(&status).unwrap();
    println!("{}", stringstatus);
}
source

pub fn state(self, state: State) -> Self

Examples found in repository?
examples/serialization.rs (line 23)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
fn main() {
    let status = StatusBuilder::mixed("coredump")
        .logo("https://www.coredump.ch/logo.png")
        .url("https://www.coredump.ch/")
        .location(Location {
            address: None,
            lat: 47.22936,
            lon: 8.82949,
            ..Default::default()
        })
        .contact(Contact {
            irc: Some("irc://freenode.net/#coredump".into()),
            twitter: Some("@coredump_ch".into()),
            foursquare: Some("525c20e5498e875d8231b1e5".into()),
            email: Some("danilo@coredump.ch".into()),
            ..Default::default()
        })
        .add_issue_report_channel(IssueReportChannel::Email)
        .add_issue_report_channel(IssueReportChannel::Twitter)
        .add_extension("ccc", "chaostreff")
        .state(State::default())
        .build()
        .expect("Creating status failed");
    let stringstatus = serde_json::to_string(&status).unwrap();
    println!("{}", stringstatus);
}
Examples found in repository?
examples/serialization.rs (line 5)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
fn main() {
    let status = StatusBuilder::mixed("coredump")
        .logo("https://www.coredump.ch/logo.png")
        .url("https://www.coredump.ch/")
        .location(Location {
            address: None,
            lat: 47.22936,
            lon: 8.82949,
            ..Default::default()
        })
        .contact(Contact {
            irc: Some("irc://freenode.net/#coredump".into()),
            twitter: Some("@coredump_ch".into()),
            foursquare: Some("525c20e5498e875d8231b1e5".into()),
            email: Some("danilo@coredump.ch".into()),
            ..Default::default()
        })
        .add_issue_report_channel(IssueReportChannel::Email)
        .add_issue_report_channel(IssueReportChannel::Twitter)
        .add_extension("ccc", "chaostreff")
        .state(State::default())
        .build()
        .expect("Creating status failed");
    let stringstatus = serde_json::to_string(&status).unwrap();
    println!("{}", stringstatus);
}
source

pub fn url<S: Into<String>>(self, url: S) -> Self

Examples found in repository?
examples/serialization.rs (line 6)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
fn main() {
    let status = StatusBuilder::mixed("coredump")
        .logo("https://www.coredump.ch/logo.png")
        .url("https://www.coredump.ch/")
        .location(Location {
            address: None,
            lat: 47.22936,
            lon: 8.82949,
            ..Default::default()
        })
        .contact(Contact {
            irc: Some("irc://freenode.net/#coredump".into()),
            twitter: Some("@coredump_ch".into()),
            foursquare: Some("525c20e5498e875d8231b1e5".into()),
            email: Some("danilo@coredump.ch".into()),
            ..Default::default()
        })
        .add_issue_report_channel(IssueReportChannel::Email)
        .add_issue_report_channel(IssueReportChannel::Twitter)
        .add_extension("ccc", "chaostreff")
        .state(State::default())
        .build()
        .expect("Creating status failed");
    let stringstatus = serde_json::to_string(&status).unwrap();
    println!("{}", stringstatus);
}
source

pub fn location(self, location: Location) -> Self

Examples found in repository?
examples/serialization.rs (lines 7-12)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
fn main() {
    let status = StatusBuilder::mixed("coredump")
        .logo("https://www.coredump.ch/logo.png")
        .url("https://www.coredump.ch/")
        .location(Location {
            address: None,
            lat: 47.22936,
            lon: 8.82949,
            ..Default::default()
        })
        .contact(Contact {
            irc: Some("irc://freenode.net/#coredump".into()),
            twitter: Some("@coredump_ch".into()),
            foursquare: Some("525c20e5498e875d8231b1e5".into()),
            email: Some("danilo@coredump.ch".into()),
            ..Default::default()
        })
        .add_issue_report_channel(IssueReportChannel::Email)
        .add_issue_report_channel(IssueReportChannel::Twitter)
        .add_extension("ccc", "chaostreff")
        .state(State::default())
        .build()
        .expect("Creating status failed");
    let stringstatus = serde_json::to_string(&status).unwrap();
    println!("{}", stringstatus);
}
source

pub fn contact(self, contact: Contact) -> Self

Examples found in repository?
examples/serialization.rs (lines 13-19)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
fn main() {
    let status = StatusBuilder::mixed("coredump")
        .logo("https://www.coredump.ch/logo.png")
        .url("https://www.coredump.ch/")
        .location(Location {
            address: None,
            lat: 47.22936,
            lon: 8.82949,
            ..Default::default()
        })
        .contact(Contact {
            irc: Some("irc://freenode.net/#coredump".into()),
            twitter: Some("@coredump_ch".into()),
            foursquare: Some("525c20e5498e875d8231b1e5".into()),
            email: Some("danilo@coredump.ch".into()),
            ..Default::default()
        })
        .add_issue_report_channel(IssueReportChannel::Email)
        .add_issue_report_channel(IssueReportChannel::Twitter)
        .add_extension("ccc", "chaostreff")
        .state(State::default())
        .build()
        .expect("Creating status failed");
    let stringstatus = serde_json::to_string(&status).unwrap();
    println!("{}", stringstatus);
}
source

pub fn spacefed(self, spacefed: Spacefed) -> Self

source

pub fn add_event(self, event: Event) -> Self

source

pub fn add_cam<S: Into<String>>(self, cam: S) -> Self

source

pub fn feeds(self, feeds: Feeds) -> Self

source

pub fn add_radio_show(self, radio_show: RadioShow) -> Self

source

pub fn add_membership_plan(self, membership_plan: MembershipPlan) -> Self

source

pub fn add_project<S: Into<String>>(self, project: S) -> Self

source

pub fn add_issue_report_channel( self, report_channel: IssueReportChannel ) -> Self

Examples found in repository?
examples/serialization.rs (line 20)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
fn main() {
    let status = StatusBuilder::mixed("coredump")
        .logo("https://www.coredump.ch/logo.png")
        .url("https://www.coredump.ch/")
        .location(Location {
            address: None,
            lat: 47.22936,
            lon: 8.82949,
            ..Default::default()
        })
        .contact(Contact {
            irc: Some("irc://freenode.net/#coredump".into()),
            twitter: Some("@coredump_ch".into()),
            foursquare: Some("525c20e5498e875d8231b1e5".into()),
            email: Some("danilo@coredump.ch".into()),
            ..Default::default()
        })
        .add_issue_report_channel(IssueReportChannel::Email)
        .add_issue_report_channel(IssueReportChannel::Twitter)
        .add_extension("ccc", "chaostreff")
        .state(State::default())
        .build()
        .expect("Creating status failed");
    let stringstatus = serde_json::to_string(&status).unwrap();
    println!("{}", stringstatus);
}
source

pub fn add_extension<V: Into<Value>>(self, name: &str, value: V) -> Self

Add an extension to the Status object.

The prefix ext_ will automatically be prepended to the name, if not already present.

Examples found in repository?
examples/serialization.rs (line 22)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
fn main() {
    let status = StatusBuilder::mixed("coredump")
        .logo("https://www.coredump.ch/logo.png")
        .url("https://www.coredump.ch/")
        .location(Location {
            address: None,
            lat: 47.22936,
            lon: 8.82949,
            ..Default::default()
        })
        .contact(Contact {
            irc: Some("irc://freenode.net/#coredump".into()),
            twitter: Some("@coredump_ch".into()),
            foursquare: Some("525c20e5498e875d8231b1e5".into()),
            email: Some("danilo@coredump.ch".into()),
            ..Default::default()
        })
        .add_issue_report_channel(IssueReportChannel::Email)
        .add_issue_report_channel(IssueReportChannel::Twitter)
        .add_extension("ccc", "chaostreff")
        .state(State::default())
        .build()
        .expect("Creating status failed");
    let stringstatus = serde_json::to_string(&status).unwrap();
    println!("{}", stringstatus);
}
source

pub fn build(self) -> Result<Status, String>

Examples found in repository?
examples/serialization.rs (line 24)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
fn main() {
    let status = StatusBuilder::mixed("coredump")
        .logo("https://www.coredump.ch/logo.png")
        .url("https://www.coredump.ch/")
        .location(Location {
            address: None,
            lat: 47.22936,
            lon: 8.82949,
            ..Default::default()
        })
        .contact(Contact {
            irc: Some("irc://freenode.net/#coredump".into()),
            twitter: Some("@coredump_ch".into()),
            foursquare: Some("525c20e5498e875d8231b1e5".into()),
            email: Some("danilo@coredump.ch".into()),
            ..Default::default()
        })
        .add_issue_report_channel(IssueReportChannel::Email)
        .add_issue_report_channel(IssueReportChannel::Twitter)
        .add_extension("ccc", "chaostreff")
        .state(State::default())
        .build()
        .expect("Creating status failed");
    let stringstatus = serde_json::to_string(&status).unwrap();
    println!("{}", stringstatus);
}

Trait Implementations§

source§

impl Clone for StatusBuilder

source§

fn clone(&self) -> StatusBuilder

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for StatusBuilder

source§

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

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

impl Default for StatusBuilder

source§

fn default() -> StatusBuilder

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

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.