Remove 'default'
This commit is contained in:
parent
d66bc425d0
commit
7f7103aa6e
10 changed files with 401 additions and 389 deletions
|
@ -203,7 +203,7 @@ use activitystreams_new::{
|
|||
};
|
||||
|
||||
fn main() -> Result<(), anyhow::Error> {
|
||||
let mut video: ApObject<Video> = ApObject::default();
|
||||
let mut video = ApObject::new(Video::new());
|
||||
|
||||
video
|
||||
.set_context(context())
|
||||
|
|
|
@ -6,7 +6,7 @@ use activitystreams_new::{
|
|||
};
|
||||
|
||||
fn main() -> Result<(), anyhow::Error> {
|
||||
let mut video: ApObject<Video> = ApObject::default();
|
||||
let mut video = ApObject::new(Video::new());
|
||||
|
||||
video
|
||||
.set_context(context())
|
||||
|
|
|
@ -142,7 +142,7 @@ pub trait ActivityExt<Kind>: AsActivity<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::activity::Question;
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -165,7 +165,7 @@ pub trait ActivityExt<Kind>: AsActivity<Kind> {
|
|||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// use activitystreams_new::prelude::*;
|
||||
/// # use activitystreams_new::{activity::Question, primitives::XsdAnyUri};
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
///
|
||||
/// question.set_result("https://example.com".parse::<XsdAnyUri>()?);
|
||||
/// # Ok(())
|
||||
|
@ -187,7 +187,7 @@ pub trait ActivityExt<Kind>: AsActivity<Kind> {
|
|||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// use activitystreams_new::prelude::*;
|
||||
/// # use activitystreams_new::{activity::Question, primitives::XsdAnyUri};
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
///
|
||||
/// question.set_many_results(vec![
|
||||
/// "https://example.com/one".parse::<XsdAnyUri>()?,
|
||||
|
@ -214,7 +214,7 @@ pub trait ActivityExt<Kind>: AsActivity<Kind> {
|
|||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// use activitystreams_new::prelude::*;
|
||||
/// # use activitystreams_new::{activity::Question, primitives::XsdAnyUri};
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
///
|
||||
/// question
|
||||
/// .add_result("https://example.com/one".parse::<XsdAnyUri>()?)
|
||||
|
@ -241,7 +241,7 @@ pub trait ActivityExt<Kind>: AsActivity<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::activity::Question;
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -258,7 +258,7 @@ pub trait ActivityExt<Kind>: AsActivity<Kind> {
|
|||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::{activity::Question, primitives::XsdAnyUri};
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
/// # question.set_result("https://example.com".parse::<XsdAnyUri>()?);
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
|
@ -278,7 +278,7 @@ pub trait ActivityExt<Kind>: AsActivity<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::activity::Question;
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -301,7 +301,7 @@ pub trait ActivityExt<Kind>: AsActivity<Kind> {
|
|||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// use activitystreams_new::prelude::*;
|
||||
/// # use activitystreams_new::{activity::Question, primitives::XsdAnyUri};
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
///
|
||||
/// question.set_instrument("https://example.com".parse::<XsdAnyUri>()?);
|
||||
/// # Ok(())
|
||||
|
@ -323,7 +323,7 @@ pub trait ActivityExt<Kind>: AsActivity<Kind> {
|
|||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// use activitystreams_new::prelude::*;
|
||||
/// # use activitystreams_new::{activity::Question, primitives::XsdAnyUri};
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
///
|
||||
/// question.set_many_instruments(vec![
|
||||
/// "https://example.com/one".parse::<XsdAnyUri>()?,
|
||||
|
@ -350,7 +350,7 @@ pub trait ActivityExt<Kind>: AsActivity<Kind> {
|
|||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// use activitystreams_new::prelude::*;
|
||||
/// # use activitystreams_new::{activity::Question, primitives::XsdAnyUri};
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
///
|
||||
/// question
|
||||
/// .add_instrument("https://example.com/one".parse::<XsdAnyUri>()?)
|
||||
|
@ -377,7 +377,7 @@ pub trait ActivityExt<Kind>: AsActivity<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::activity::Question;
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -394,7 +394,7 @@ pub trait ActivityExt<Kind>: AsActivity<Kind> {
|
|||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::{activity::Question, primitives::XsdAnyUri};
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
/// # question.set_instrument("https://example.com".parse::<XsdAnyUri>()?);
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
|
@ -1158,7 +1158,7 @@ pub trait QuestionExt: AsQuestion {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::activity::Question;
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -1178,7 +1178,7 @@ pub trait QuestionExt: AsQuestion {
|
|||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// use activitystreams_new::prelude::*;
|
||||
/// # use activitystreams_new::{activity::Question, primitives::XsdAnyUri};
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
///
|
||||
/// question.set_one_of("https://example.com".parse::<XsdAnyUri>()?);
|
||||
/// # Ok(())
|
||||
|
@ -1200,7 +1200,7 @@ pub trait QuestionExt: AsQuestion {
|
|||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// use activitystreams_new::prelude::*;
|
||||
/// # use activitystreams_new::{activity::Question, primitives::XsdAnyUri};
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
///
|
||||
/// question.set_many_one_ofs(vec![
|
||||
/// "https://example.com/one".parse::<XsdAnyUri>()?,
|
||||
|
@ -1227,7 +1227,7 @@ pub trait QuestionExt: AsQuestion {
|
|||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// use activitystreams_new::prelude::*;
|
||||
/// # use activitystreams_new::{activity::Question, primitives::XsdAnyUri};
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
///
|
||||
/// question
|
||||
/// .add_one_of("https://example.com/one".parse::<XsdAnyUri>()?)
|
||||
|
@ -1254,7 +1254,7 @@ pub trait QuestionExt: AsQuestion {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::activity::Question;
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -1271,7 +1271,7 @@ pub trait QuestionExt: AsQuestion {
|
|||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::{activity::Question, primitives::XsdAnyUri};
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
/// # question.set_one_of("https://example.com".parse::<XsdAnyUri>()?);
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
|
@ -1291,7 +1291,7 @@ pub trait QuestionExt: AsQuestion {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::activity::Question;
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -1311,7 +1311,7 @@ pub trait QuestionExt: AsQuestion {
|
|||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// use activitystreams_new::prelude::*;
|
||||
/// # use activitystreams_new::{activity::Question, primitives::XsdAnyUri};
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
///
|
||||
/// question.set_any_of("https://example.com".parse::<XsdAnyUri>()?);
|
||||
/// # Ok(())
|
||||
|
@ -1333,7 +1333,7 @@ pub trait QuestionExt: AsQuestion {
|
|||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// use activitystreams_new::prelude::*;
|
||||
/// # use activitystreams_new::{activity::Question, primitives::XsdAnyUri};
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
///
|
||||
/// question.set_many_any_ofs(vec![
|
||||
/// "https://example.com/one".parse::<XsdAnyUri>()?,
|
||||
|
@ -1360,7 +1360,7 @@ pub trait QuestionExt: AsQuestion {
|
|||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// use activitystreams_new::prelude::*;
|
||||
/// # use activitystreams_new::{activity::Question, primitives::XsdAnyUri};
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
///
|
||||
/// question
|
||||
/// .add_any_of("https://example.com/one".parse::<XsdAnyUri>()?)
|
||||
|
@ -1387,7 +1387,7 @@ pub trait QuestionExt: AsQuestion {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::activity::Question;
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -1404,7 +1404,7 @@ pub trait QuestionExt: AsQuestion {
|
|||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::{activity::Question, primitives::XsdAnyUri};
|
||||
/// # let mut question = Question::default();
|
||||
/// # let mut question = Question::new();
|
||||
/// # question.set_any_of("https://example.com".parse::<XsdAnyUri>()?);
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
|
@ -1608,7 +1608,7 @@ pub type Remove = ActorAndObjectOptOriginAndTarget<RemoveType>;
|
|||
/// Activity objects are specializations of the base Object type that provide information about
|
||||
/// actions that have either already occurred, are in the process of occurring, or may occur in the
|
||||
/// future.
|
||||
#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize, TypedBuilder)]
|
||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, TypedBuilder)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[builder(doc)]
|
||||
pub struct Activity<Kind> {
|
||||
|
@ -1948,7 +1948,7 @@ pub struct Travel {
|
|||
///
|
||||
/// Either of the anyOf and oneOf properties MAY be used to express possible answers, but a
|
||||
/// Question object MUST NOT have both properties.
|
||||
#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize, TypedBuilder)]
|
||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, TypedBuilder)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[builder(doc)]
|
||||
pub struct Question {
|
||||
|
|
130
src/actor.rs
130
src/actor.rs
|
@ -8,11 +8,13 @@
|
|||
//! primitives::XsdAnyUri,
|
||||
//! };
|
||||
//!
|
||||
//! let mut person = ApActor::<Person>::default();
|
||||
//! let mut person = ApActor::new(
|
||||
//! "https://example.com/actor/inbox".parse()?,
|
||||
//! "https://example.com/actor/outbox".parse()?,
|
||||
//! Person::new(),
|
||||
//! );
|
||||
//!
|
||||
//! person
|
||||
//! .set_inbox("https://example.com/actor/inbox".parse()?)
|
||||
//! .set_outbox("https://example.com/actor/outbox".parse()?)
|
||||
//! .set_following("https://example.com/actor/following".parse()?)
|
||||
//! .set_followers("https://example.com/actor/followers".parse()?);
|
||||
//! #
|
||||
|
@ -59,8 +61,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
/// Fetch the inbox for the current actor
|
||||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// let inbox_ref = person.inbox();
|
||||
|
@ -76,8 +78,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// person.set_inbox("https://example.com/inbox".parse()?);
|
||||
|
@ -92,8 +94,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
/// Fetch the outbox for the current actor
|
||||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// let outbox_ref = person.outbox();
|
||||
|
@ -109,8 +111,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// person.set_outbox("https://example.com/outbox".parse()?);
|
||||
|
@ -125,8 +127,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
/// Fetch the following link for the current actor
|
||||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// if let Some(following) = person.following() {
|
||||
|
@ -144,8 +146,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// person.set_following("https://example.com/following".parse()?);
|
||||
|
@ -160,8 +162,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
/// Take the following link for the current actor, leaving nothing
|
||||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// if let Some(following) = person.take_following() {
|
||||
|
@ -176,8 +178,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// # person.set_following("https://example.com/following".parse()?);
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -195,8 +197,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
/// Fetch the followers link for the current actor
|
||||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// if let Some(followers) = person.take_followers() {
|
||||
|
@ -214,8 +216,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// person.set_followers("https://example.com/followers".parse()?);
|
||||
|
@ -230,8 +232,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
/// Take the followers link for the current actor, leaving nothing
|
||||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// if let Some(followers) = person.take_followers() {
|
||||
|
@ -246,8 +248,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// # person.set_followers("https://example.com/followers".parse()?);
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -265,8 +267,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
/// Fetch the liked link for the current actor
|
||||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// if let Some(liked) = person.take_liked() {
|
||||
|
@ -284,8 +286,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// person.set_streams("https://example.com/liked".parse()?);
|
||||
|
@ -300,8 +302,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
/// Take the liked link for the current actor, leaving nothing
|
||||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// if let Some(liked) = person.take_liked() {
|
||||
|
@ -316,8 +318,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// # person.set_liked("https://example.com/liked".parse()?);
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -335,8 +337,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
/// Fetch the streams links for the current actor
|
||||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// if let Some(streams) = person.take_streams() {
|
||||
|
@ -354,8 +356,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// person.set_streams("https://example.com/streams".parse()?);
|
||||
|
@ -371,8 +373,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// person.set_many_streams(vec![
|
||||
|
@ -395,8 +397,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// person
|
||||
|
@ -420,8 +422,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
/// Take the streams links for the current actor, leaving nothing
|
||||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// if let Some(streams) = person.take_streams() {
|
||||
|
@ -436,8 +438,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// # person.set_streams("https://example.com/streams".parse()?);
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -455,8 +457,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
/// Fetch the preferred_username for the current actor
|
||||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// if let Some(preferred_username) = person.preferred_username() {
|
||||
|
@ -474,8 +476,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// person.set_preferred_username("user123".into());
|
||||
|
@ -490,8 +492,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
/// Take the preferred_username from the current actor, leaving nothing
|
||||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// if let Some(preferred_username) = person.take_preferred_username() {
|
||||
|
@ -505,8 +507,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
/// Delete the preferred_username from the current actor
|
||||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// # person.set_preferred_username("hey".into());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -522,8 +524,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
/// Fetch the endpoints for the current actor
|
||||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// if let Some(endpoints) = person.endpoints() {
|
||||
|
@ -541,8 +543,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::actor::{ApActor, Endpoints, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Endpoints, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// person.set_endpoints(Endpoints {
|
||||
|
@ -560,8 +562,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
/// Take the endpoints from the current actor, leaving nothing
|
||||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// if let Some(endpoints) = person.endpoints() {
|
||||
|
@ -575,8 +577,8 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
|
|||
/// Delete the endpoints from the current actor
|
||||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::actor::{ApActor, Person};
|
||||
/// # let mut person = ApActor::<Person>::default();
|
||||
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
|
||||
/// # let mut person = ApActor::new(context(), context(), Person::new());
|
||||
/// # person.set_endpoints(Default::default());
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -638,7 +640,7 @@ pub type Service = Object<ServiceType>;
|
|||
/// implementation MUST also specify the core vocabulary type. For instance, some vocabularies
|
||||
/// (e.g. VCard) define their own types for describing people. An implementation that wishes, for
|
||||
/// example, to use a vcard:Individual as an Actor MUST also identify that Actor as a Person.
|
||||
#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize, TypedBuilder)]
|
||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, TypedBuilder)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[builder(doc)]
|
||||
pub struct ApActor<Inner> {
|
||||
|
|
110
src/base.rs
110
src/base.rs
|
@ -10,7 +10,7 @@
|
|||
//! primitives::XsdString,
|
||||
//! security,
|
||||
//! };
|
||||
//! let mut video = Video::default();
|
||||
//! let mut video = Video::new();
|
||||
//!
|
||||
//! video
|
||||
//! .set_id("https://example.com".parse()?)
|
||||
|
@ -20,7 +20,7 @@
|
|||
//!
|
||||
//! let any_base = video.into_any_base()?;
|
||||
//!
|
||||
//! let mut new_video = Video::default();
|
||||
//! let mut new_video = Video::new();
|
||||
//!
|
||||
//! new_video.set_preview(any_base);
|
||||
//! #
|
||||
|
@ -58,7 +58,7 @@ pub trait ExtendsExt<Kind>: Extends<Kind> {
|
|||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// use activitystreams_new::{object::Video, prelude::*};
|
||||
/// let video = Video::default();
|
||||
/// let video = Video::new();
|
||||
///
|
||||
/// let any_base = video.into_any_base()?;
|
||||
/// #
|
||||
|
@ -81,7 +81,7 @@ pub trait ExtendsExt<Kind>: Extends<Kind> {
|
|||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// use activitystreams_new::{object::Video, prelude::*};
|
||||
/// # let video = Video::default();
|
||||
/// # let video = Video::new();
|
||||
/// # let any_base = video.into_any_base()?;
|
||||
/// let video = Video::from_any_base(any_base)?;
|
||||
/// #
|
||||
|
@ -126,7 +126,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::object::Video;
|
||||
/// # let video = Video::default();
|
||||
/// # let video = Video::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -145,7 +145,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::object::Video;
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// #
|
||||
/// use activitystreams_new::{context, prelude::*};
|
||||
///
|
||||
|
@ -165,7 +165,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::object::Video;
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// #
|
||||
/// use activitystreams_new::{context, prelude::*, security};
|
||||
///
|
||||
|
@ -187,7 +187,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::object::Video;
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// #
|
||||
/// use activitystreams_new::{context, prelude::*, security};
|
||||
///
|
||||
|
@ -214,7 +214,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::object::Video;
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -230,7 +230,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::{context, object::Video};
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// # video.set_context(context());
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
|
@ -248,7 +248,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::{object::Video, primitives::XsdString};
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -270,7 +270,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::{object::Video, primitives::XsdString};
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -287,7 +287,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::{object::Video, primitives::XsdString};
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -303,7 +303,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::{context, object::Video};
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// # video.set_id(context());
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
|
@ -321,7 +321,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::{object::Video, primitives::XsdString};
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -342,7 +342,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::object::{Video, kind::VideoType};
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
/// video.set_kind(VideoType);
|
||||
|
@ -356,7 +356,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::{object::Video, primitives::XsdString};
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -372,7 +372,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::{object::{Video, kind::VideoType}};
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// # video.set_kind(VideoType);
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
|
@ -390,7 +390,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
///
|
||||
/// ```
|
||||
/// # use activitystreams_new::{object::Video, primitives::XsdString};
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -412,7 +412,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
/// ```rust
|
||||
/// use activitystreams_new::prelude::*;
|
||||
/// # use activitystreams_new::{object::Video, primitives::XsdString};
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// #
|
||||
/// video.set_name(XsdString::from("hi"));
|
||||
/// ```
|
||||
|
@ -431,7 +431,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
/// ```rust
|
||||
/// use activitystreams_new::prelude::*;
|
||||
/// # use activitystreams_new::{object::Video, primitives::XsdString};
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// #
|
||||
/// video.set_many_names(vec![XsdString::from("hi"), XsdString::from("hey")]);
|
||||
/// ```
|
||||
|
@ -452,7 +452,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
/// ```rust
|
||||
/// use activitystreams_new::prelude::*;
|
||||
/// # use activitystreams_new::{object::Video, primitives::XsdString};
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// #
|
||||
/// video
|
||||
/// .add_name(XsdString::from("hi"))
|
||||
|
@ -477,7 +477,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::object::Video;
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -494,7 +494,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
/// ```rust
|
||||
/// use activitystreams_new::prelude::*;
|
||||
/// # use activitystreams_new::{object::Video, primitives::XsdString};
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// # video.set_name(XsdString::from("hi"));
|
||||
/// #
|
||||
///
|
||||
|
@ -511,7 +511,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::object::Video;
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -534,7 +534,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// use activitystreams_new::prelude::*;
|
||||
/// # use activitystreams_new::{object::Video, primitives::XsdAnyUri};
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
///
|
||||
/// video.set_media_type("video/webm".parse()?);
|
||||
/// # Ok(())
|
||||
|
@ -549,7 +549,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::object::Video;
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -566,7 +566,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::{object::Video};
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// # video.set_media_type("video/webm".parse()?);
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
|
@ -586,7 +586,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::object::Video;
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -609,7 +609,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// use activitystreams_new::prelude::*;
|
||||
/// # use activitystreams_new::{object::Video, primitives::XsdAnyUri};
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
///
|
||||
/// video.set_preview("https://example.com".parse::<XsdAnyUri>()?);
|
||||
/// # Ok(())
|
||||
|
@ -631,7 +631,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// use activitystreams_new::prelude::*;
|
||||
/// # use activitystreams_new::{object::Video, primitives::XsdAnyUri};
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
///
|
||||
/// video.set_many_previews(vec![
|
||||
/// "https://example.com/one".parse::<XsdAnyUri>()?,
|
||||
|
@ -658,7 +658,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// use activitystreams_new::prelude::*;
|
||||
/// # use activitystreams_new::{object::Video, primitives::XsdAnyUri};
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
///
|
||||
/// video
|
||||
/// .add_preview("https://example.com/one".parse::<XsdAnyUri>()?)
|
||||
|
@ -685,7 +685,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::object::Video;
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -702,7 +702,7 @@ pub trait BaseExt<Kind>: AsBase<Kind> {
|
|||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::{object::Video, primitives::XsdAnyUri};
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// # video.set_preview("https://example.com".parse::<XsdAnyUri>()?);
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
|
@ -739,7 +739,7 @@ pub struct AnyBase(Either<IdOrBase, XsdString>);
|
|||
/// Although the spec does not define a type more abstract that Object or Link, it does define
|
||||
/// fields present in both, so for the sake of "Everything derives from something," I've
|
||||
/// implemented a type.
|
||||
#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize, TypedBuilder)]
|
||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, TypedBuilder)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[builder(doc)]
|
||||
pub struct Base<Kind> {
|
||||
|
@ -870,7 +870,7 @@ impl<Kind> Base<Kind> {
|
|||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::{base::Base, object::{Video, kind::VideoType}};
|
||||
/// # let base = Base::<VideoType>::default();
|
||||
/// # let base = Base::<VideoType>::new();
|
||||
/// #
|
||||
/// let video = base.extend::<Video>()?;
|
||||
/// #
|
||||
|
@ -889,7 +889,7 @@ impl<Kind> Base<Kind> {
|
|||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::{base::Base, object::Video};
|
||||
/// # let video = Video::default();
|
||||
/// # let video = Video::new();
|
||||
/// #
|
||||
/// let base = Base::retract(video)?;
|
||||
/// #
|
||||
|
@ -919,7 +919,7 @@ impl<Kind> Base<Kind> {
|
|||
/// ```rust
|
||||
/// use activitystreams_new::{base::Base, prelude::*};
|
||||
///
|
||||
/// let mut base = Base::<String>::default();
|
||||
/// let mut base = Base::<String>::new();
|
||||
/// base.set_kind("Hey".to_owned());
|
||||
///
|
||||
/// let new_base = base.map_kind(|kind| match kind.as_str() {
|
||||
|
@ -947,7 +947,7 @@ impl<Kind> Base<Kind> {
|
|||
/// ```rust
|
||||
/// use activitystreams_new::{base::Base, prelude::*};
|
||||
///
|
||||
/// let mut base = Base::<String>::default();
|
||||
/// let mut base = Base::<String>::new();
|
||||
/// base.set_kind("Hey".to_owned());
|
||||
///
|
||||
/// let new_base = base.try_map_kind(|kind| match kind.as_str() {
|
||||
|
@ -984,7 +984,7 @@ impl AnyBase {
|
|||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::{object::Video, base::AnyBase};
|
||||
/// # let video = Video::default();
|
||||
/// # let video = Video::new();
|
||||
/// let any_base = AnyBase::from_extended(video)?;
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
|
@ -1035,7 +1035,7 @@ impl AnyBase {
|
|||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::{object::Video, base::AnyBase};
|
||||
/// # let video = Video::default();
|
||||
/// # let video = Video::new();
|
||||
/// let any_base = AnyBase::from_extended(video)?;
|
||||
/// assert!(any_base.is_base());
|
||||
/// # Ok(())
|
||||
|
@ -1056,7 +1056,7 @@ impl AnyBase {
|
|||
/// # use activitystreams_new::{
|
||||
/// # object::Video, base::AnyBase, prelude::*, primitives::XsdAnyUri
|
||||
/// # };
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// let id = "https://example.com".parse::<XsdAnyUri>()?;
|
||||
///
|
||||
/// video.set_id(id.clone());
|
||||
|
@ -1094,7 +1094,7 @@ impl AnyBase {
|
|||
/// # use activitystreams_new::{
|
||||
/// # object::{kind::VideoType, Video}, base::AnyBase, prelude::*,
|
||||
/// # };
|
||||
/// # let mut video = Video::default();
|
||||
/// # let mut video = Video::new();
|
||||
/// #
|
||||
/// video.set_kind(VideoType);
|
||||
///
|
||||
|
@ -1146,7 +1146,7 @@ impl AnyBase {
|
|||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::{base::AnyBase, object::Video};
|
||||
/// # let video = Video::default();
|
||||
/// # let video = Video::new();
|
||||
/// #
|
||||
/// let any_base = AnyBase::from_extended(video)?;
|
||||
///
|
||||
|
@ -1194,7 +1194,7 @@ impl AnyBase {
|
|||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::{base::AnyBase, object::Video};
|
||||
/// # let video = Video::default();
|
||||
/// # let video = Video::new();
|
||||
/// #
|
||||
/// let any_base = AnyBase::from_extended(video)?;
|
||||
///
|
||||
|
@ -1250,7 +1250,7 @@ impl AnyBase {
|
|||
/// ```
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::{base::{AnyBase, Base}, object::Video};
|
||||
/// # let video = Video::default();
|
||||
/// # let video = Video::new();
|
||||
/// let mut any_base = AnyBase::from_xsd_string("hi".into());
|
||||
///
|
||||
/// let base = Base::retract(video)?.into_generic()?;
|
||||
|
@ -1293,7 +1293,7 @@ impl AnyBase {
|
|||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::object::Video;
|
||||
/// # let video = Video::default();
|
||||
/// # let video = Video::new();
|
||||
/// use activitystreams_new::base::{AnyBase, Base};
|
||||
///
|
||||
/// let base = Base::retract(video)?.into_generic()?;
|
||||
|
@ -1367,7 +1367,7 @@ impl OneOrMany<AnyBase> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::{base::Base, primitives::OneOrMany};
|
||||
/// # let base = Base::default();
|
||||
/// # let base = Base::new();
|
||||
/// #
|
||||
/// let one = OneOrMany::from_base(base);
|
||||
///
|
||||
|
@ -1411,7 +1411,7 @@ impl OneOrMany<AnyBase> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::{base::Base, primitives::OneOrMany};
|
||||
/// # let base = Base::default();
|
||||
/// # let base = Base::new();
|
||||
/// #
|
||||
/// let one = OneOrMany::from_base(base);
|
||||
///
|
||||
|
@ -1450,7 +1450,7 @@ impl OneOrMany<AnyBase> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::base::Base;
|
||||
/// # let base = Base::default();
|
||||
/// # let base = Base::new();
|
||||
/// #
|
||||
/// use activitystreams_new::primitives::OneOrMany;
|
||||
///
|
||||
|
@ -1464,7 +1464,7 @@ impl OneOrMany<AnyBase> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::{base::Base, context, primitives::OneOrMany};
|
||||
/// # let base = Base::default();
|
||||
/// # let base = Base::new();
|
||||
/// #
|
||||
/// let mut one = OneOrMany::from_base(base);
|
||||
///
|
||||
|
@ -1481,7 +1481,7 @@ impl OneOrMany<AnyBase> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::{base::Base, primitives::OneOrMany};
|
||||
/// # let base = Base::default();
|
||||
/// # let base = Base::new();
|
||||
/// #
|
||||
/// let mut one = OneOrMany::from_base(base);
|
||||
///
|
||||
|
@ -1498,7 +1498,7 @@ impl OneOrMany<AnyBase> {
|
|||
///
|
||||
/// ```
|
||||
/// # use activitystreams_new::{base::Base, context, primitives::OneOrMany};
|
||||
/// # let base = Base::default();
|
||||
/// # let base = Base::new();
|
||||
/// #
|
||||
/// let mut one = OneOrMany::from_xsd_any_uri(context());
|
||||
///
|
||||
|
@ -1543,8 +1543,8 @@ impl OneOrMany<AnyBase> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::base::Base;
|
||||
/// # let base1 = Base::default();
|
||||
/// # let base2 = Base::default();
|
||||
/// # let base1 = Base::new();
|
||||
/// # let base2 = Base::new();
|
||||
/// use activitystreams_new::{context, primitives::OneOrMany};
|
||||
///
|
||||
/// let mut many = OneOrMany::from_xsd_any_uri(context());
|
||||
|
|
|
@ -9,12 +9,9 @@
|
|||
//! primitives::XsdAnyUri,
|
||||
//! };
|
||||
//!
|
||||
//! let mut collection = OrderedCollection::builder()
|
||||
//! .items(vec![
|
||||
//! "https://example.com/notes/1234".parse::<XsdAnyUri>()?.into(),
|
||||
//! ])
|
||||
//! .inner(Default::default())
|
||||
//! .build();
|
||||
//! let mut collection = OrderedCollection::new(vec![
|
||||
//! "https://example.com/notes/1234".parse::<XsdAnyUri>()?.into(),
|
||||
//! ]);
|
||||
//!
|
||||
//! collection
|
||||
//! .set_total_items(1)
|
||||
|
|
14
src/lib.rs
14
src/lib.rs
|
@ -203,7 +203,7 @@
|
|||
//! };
|
||||
//!
|
||||
//! fn main() -> Result<(), anyhow::Error> {
|
||||
//! let mut video: ApObject<Video> = ApObject::default();
|
||||
//! let mut video = ApObject::new(Video::new());
|
||||
//!
|
||||
//! video
|
||||
//! .set_context(context())
|
||||
|
@ -294,23 +294,25 @@ pub mod prelude {
|
|||
//! security
|
||||
//! };
|
||||
//!
|
||||
//! let mut person = ApActor::<Person>::default();
|
||||
//! let mut person = ApActor::new(
|
||||
//! "http://localhost:8080/inbox".parse()?,
|
||||
//! "http:/localhost:8080/outbox".parse()?,
|
||||
//! Person::new(),
|
||||
//! );
|
||||
//! person
|
||||
//! .set_inbox("https://localhost:8080/inbox".parse()?)
|
||||
//! .set_outbox("https://localhost:8080/outbox".parse()?)
|
||||
//! .set_name(XsdString::from("Demo Account"))
|
||||
//! .set_preferred_username(XsdString::from("demo"))
|
||||
//! .set_id("https://localhost:8080/actor".parse()?)
|
||||
//! .set_url("https://localhost:8080/actor".parse::<XsdAnyUri>()?);
|
||||
//!
|
||||
//! let mut preview = Image::default();
|
||||
//! let mut preview = Image::new();
|
||||
//!
|
||||
//! preview
|
||||
//! .set_url("https://localhost:8080/preview.png".parse::<XsdAnyUri>()?)
|
||||
//! .set_media_type("image/png".parse()?)
|
||||
//! .set_id("https://localhostst:8080/preview.png".parse()?);
|
||||
//!
|
||||
//! let mut video = ApObject::<Video>::default();
|
||||
//! let mut video = ApObject::new(Video::new());
|
||||
//!
|
||||
//! video
|
||||
//! .set_id("http://localhost:8080/video.webm".parse()?)
|
||||
|
|
50
src/link.rs
50
src/link.rs
|
@ -9,13 +9,13 @@
|
|||
//! primitives::XsdAnyUri,
|
||||
//! };
|
||||
//!
|
||||
//! let mut mention = Mention::default();
|
||||
//! let mut mention = Mention::new();
|
||||
//!
|
||||
//! mention
|
||||
//! .set_href("https://example.com".parse()?)
|
||||
//! .set_hreflang("en".into())
|
||||
//! .set_rel("link".into())
|
||||
//! .set_preview(Image::default().into_any_base()?);
|
||||
//! .set_preview(Image::new().into_any_base()?);
|
||||
//! #
|
||||
//! # Ok(())
|
||||
//! # }
|
||||
|
@ -61,7 +61,7 @@ pub trait LinkExt<Kind>: AsLink<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::link::Mention;
|
||||
/// # let mention = Mention::default();
|
||||
/// # let mention = Mention::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -81,7 +81,7 @@ pub trait LinkExt<Kind>: AsLink<Kind> {
|
|||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::link::Mention;
|
||||
/// # let mut mention = Mention::default();
|
||||
/// # let mut mention = Mention::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -98,7 +98,7 @@ pub trait LinkExt<Kind>: AsLink<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::link::Mention;
|
||||
/// # let mut mention = Mention::default();
|
||||
/// # let mut mention = Mention::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -115,7 +115,7 @@ pub trait LinkExt<Kind>: AsLink<Kind> {
|
|||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::link::Mention;
|
||||
/// # let mut mention = Mention::default();
|
||||
/// # let mut mention = Mention::new();
|
||||
/// # mention.set_href("https://example.com".parse()?);
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
|
@ -135,7 +135,7 @@ pub trait LinkExt<Kind>: AsLink<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::link::Mention;
|
||||
/// # let mention = Mention::default();
|
||||
/// # let mention = Mention::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -154,7 +154,7 @@ pub trait LinkExt<Kind>: AsLink<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::link::Mention;
|
||||
/// # let mut mention = Mention::default();
|
||||
/// # let mut mention = Mention::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -169,7 +169,7 @@ pub trait LinkExt<Kind>: AsLink<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::link::Mention;
|
||||
/// # let mut mention = Mention::default();
|
||||
/// # let mut mention = Mention::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -186,7 +186,7 @@ pub trait LinkExt<Kind>: AsLink<Kind> {
|
|||
/// ```rust
|
||||
/// # fn main() -> Result<(), anyhow::Error> {
|
||||
/// # use activitystreams_new::link::Mention;
|
||||
/// # let mut mention = Mention::default();
|
||||
/// # let mut mention = Mention::new();
|
||||
/// # mention.set_hreflang("https://example.com".parse()?);
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
|
@ -206,7 +206,7 @@ pub trait LinkExt<Kind>: AsLink<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::link::Mention;
|
||||
/// # let mention = Mention::default();
|
||||
/// # let mention = Mention::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -225,7 +225,7 @@ pub trait LinkExt<Kind>: AsLink<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::link::Mention;
|
||||
/// # let mut mention = Mention::default();
|
||||
/// # let mut mention = Mention::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -242,7 +242,7 @@ pub trait LinkExt<Kind>: AsLink<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::link::Mention;
|
||||
/// # let mut mention = Mention::default();
|
||||
/// # let mut mention = Mention::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -263,7 +263,7 @@ pub trait LinkExt<Kind>: AsLink<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::link::Mention;
|
||||
/// # let mut mention = Mention::default();
|
||||
/// # let mut mention = Mention::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -287,7 +287,7 @@ pub trait LinkExt<Kind>: AsLink<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::link::Mention;
|
||||
/// # let mut mention = Mention::default();
|
||||
/// # let mut mention = Mention::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -303,7 +303,7 @@ pub trait LinkExt<Kind>: AsLink<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::link::Mention;
|
||||
/// # let mut mention = Mention::default();
|
||||
/// # let mut mention = Mention::new();
|
||||
/// # mention.set_rel("link".into());
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
|
@ -321,7 +321,7 @@ pub trait LinkExt<Kind>: AsLink<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::link::Mention;
|
||||
/// # let mut mention = Mention::default();
|
||||
/// # let mut mention = Mention::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -342,7 +342,7 @@ pub trait LinkExt<Kind>: AsLink<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::link::Mention;
|
||||
/// # let mut mention = Mention::default();
|
||||
/// # let mut mention = Mention::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -360,7 +360,7 @@ pub trait LinkExt<Kind>: AsLink<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::link::Mention;
|
||||
/// # let mut mention = Mention::default();
|
||||
/// # let mut mention = Mention::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -376,7 +376,7 @@ pub trait LinkExt<Kind>: AsLink<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::link::Mention;
|
||||
/// # let mut mention = Mention::default();
|
||||
/// # let mut mention = Mention::new();
|
||||
/// # mention.set_height(5);
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
|
@ -394,7 +394,7 @@ pub trait LinkExt<Kind>: AsLink<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::link::Mention;
|
||||
/// # let mut mention = Mention::default();
|
||||
/// # let mut mention = Mention::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -415,7 +415,7 @@ pub trait LinkExt<Kind>: AsLink<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::link::Mention;
|
||||
/// # let mut mention = Mention::default();
|
||||
/// # let mut mention = Mention::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -433,7 +433,7 @@ pub trait LinkExt<Kind>: AsLink<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::link::Mention;
|
||||
/// # let mut mention = Mention::default();
|
||||
/// # let mut mention = Mention::new();
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
///
|
||||
|
@ -449,7 +449,7 @@ pub trait LinkExt<Kind>: AsLink<Kind> {
|
|||
///
|
||||
/// ```rust
|
||||
/// # use activitystreams_new::link::Mention;
|
||||
/// # let mut mention = Mention::default();
|
||||
/// # let mut mention = Mention::new();
|
||||
/// # mention.set_width(5);
|
||||
/// #
|
||||
/// use activitystreams_new::prelude::*;
|
||||
|
@ -486,7 +486,7 @@ pub type Mention = Link<MentionType>;
|
|||
/// object might have multiple such visual representations -- multiple screenshots, for instance,
|
||||
/// or the same image at different resolutions. In Activity Streams 2.0, there are essentially
|
||||
/// three ways of describing such references.
|
||||
#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize, TypedBuilder)]
|
||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, TypedBuilder)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[builder(doc)]
|
||||
pub struct Link<Kind> {
|
||||
|
|
402
src/object.rs
402
src/object.rs
File diff suppressed because it is too large
Load diff
|
@ -35,13 +35,14 @@
|
|||
//! pub public_key_pem: XsdString,
|
||||
//! }
|
||||
//!
|
||||
//! #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)]
|
||||
//! #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||
//! #[serde(rename_all = "camelCase")]
|
||||
//! pub struct PublicKey<Inner> {
|
||||
//! pub public_key: PublicKeyValues,
|
||||
//! pub inner: Inner,
|
||||
//! }
|
||||
//!
|
||||
//!
|
||||
//! /// Then, we'll implement Extends so we can produce a PublicKey<Object> from an AnyBase.
|
||||
//!
|
||||
//! impl<Inner, Kind> Extends<Kind> for PublicKey<Inner>
|
||||
|
@ -220,16 +221,26 @@
|
|||
//!
|
||||
//! pub type ExtendedPerson = PublicKey<ApActor<Person>>;
|
||||
//!
|
||||
//! impl ExtendedPerson {
|
||||
//! pub fn new(inbox: XsdAnyUri, outbox: XsdAnyUri) -> Self {
|
||||
//! PublicKey {
|
||||
//! public_key: Default::default(),
|
||||
//! inner: ApActor::new(inbox, outbox, Person::new()),
|
||||
//! }
|
||||
//! }
|
||||
//! }
|
||||
//!
|
||||
//! fn main() -> Result<(), anyhow::Error> {
|
||||
//! let mut extended_person = ExtendedPerson::default();
|
||||
//! let mut extended_person = ExtendedPerson::new(
|
||||
//! "https://example.com/user/inbox".parse()?,
|
||||
//! "https://example.com/user/outbox".parse()?,
|
||||
//! );
|
||||
//!
|
||||
//! extended_person
|
||||
//! .set_kind(PersonType)
|
||||
//! .set_id("https://example.com/user".parse()?)
|
||||
//! .set_name(XsdString::from("Demo User"))
|
||||
//! .set_preferred_username(XsdString::from("user"))
|
||||
//! .set_inbox("https://example.com/user/inbox".parse()?)
|
||||
//! .set_outbox("https://example.com/user/outbox".parse()?)
|
||||
//! .set_key_pem(XsdString::from(
|
||||
//! "------ BEGIN PUBLIC KEY ------\nasdfasdfasdfasdfasdfasdf..."
|
||||
//! ))
|
||||
|
|
Loading…
Reference in a new issue