mirror of
https://git.asonix.dog/asonix/activitystreams.git
synced 2024-11-25 21:31:00 +00:00
Fix tests
This commit is contained in:
parent
3258d7e0a7
commit
67cd3b8a8c
10 changed files with 76 additions and 27 deletions
|
@ -1,4 +1,4 @@
|
||||||
use activitystreams::object::streams::Video;
|
use activitystreams::object::Video;
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut v = Video::default();
|
let mut v = Video::default();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use activitystreams::{
|
use activitystreams::{
|
||||||
collection::{apub::OrderedCollection, properties::CollectionProperties},
|
collection::{properties::CollectionProperties, OrderedCollection},
|
||||||
object::{streams::Page, ObjectBox},
|
object::{ObjectBox, Page},
|
||||||
};
|
};
|
||||||
use anyhow::Error;
|
use anyhow::Error;
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//! Namespace for Activity types
|
||||||
|
|
||||||
#[cfg(feature = "kinds")]
|
#[cfg(feature = "kinds")]
|
||||||
pub mod kind;
|
pub mod kind;
|
||||||
#[cfg(feature = "types")]
|
#[cfg(feature = "types")]
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
//! properties::ActivityProperties,
|
//! properties::ActivityProperties,
|
||||||
//! Activity, ActivityBox,
|
//! Activity, ActivityBox,
|
||||||
//! },
|
//! },
|
||||||
|
//! ext::Ext,
|
||||||
//! object::{
|
//! object::{
|
||||||
//! properties::ObjectProperties,
|
//! properties::ObjectProperties,
|
||||||
//! Object, ObjectBox,
|
//! Object, ObjectBox,
|
||||||
|
@ -34,7 +35,15 @@
|
||||||
//! };
|
//! };
|
||||||
//! use serde::{Deserialize, Serialize};
|
//! use serde::{Deserialize, Serialize};
|
||||||
//!
|
//!
|
||||||
//! #[derive(Clone, Debug, Serialize, Deserialize, PropRefs)]
|
//! #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)]
|
||||||
|
//! #[serde(transparent)]
|
||||||
|
//! pub struct ObjProps(pub ObjectProperties);
|
||||||
|
//!
|
||||||
|
//! #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)]
|
||||||
|
//! #[serde(transparent)]
|
||||||
|
//! pub struct ActivityProps(pub ActivityProperties);
|
||||||
|
//!
|
||||||
|
//! #[derive(Clone, Debug, Default, Serialize, Deserialize, PropRefs)]
|
||||||
//! #[serde(rename_all = "camelCase")]
|
//! #[serde(rename_all = "camelCase")]
|
||||||
//! #[prop_refs(Object)]
|
//! #[prop_refs(Object)]
|
||||||
//! #[prop_refs(Activity)]
|
//! #[prop_refs(Activity)]
|
||||||
|
@ -49,11 +58,11 @@
|
||||||
//!
|
//!
|
||||||
//! #[serde(flatten)]
|
//! #[serde(flatten)]
|
||||||
//! #[prop_refs]
|
//! #[prop_refs]
|
||||||
//! pub object_properties: ObjectProperties,
|
//! pub object_properties: ObjProps,
|
||||||
//!
|
//!
|
||||||
//! #[serde(flatten)]
|
//! #[serde(flatten)]
|
||||||
//! #[prop_refs]
|
//! #[prop_refs]
|
||||||
//! pub activity_properties: ActivityProperties,
|
//! pub activity_properties: ActivityProps,
|
||||||
//! }
|
//! }
|
||||||
//! #
|
//! #
|
||||||
//! # fn main() {}
|
//! # fn main() {}
|
||||||
|
|
|
@ -27,15 +27,28 @@
|
||||||
//! properties::ApActorProperties,
|
//! properties::ApActorProperties,
|
||||||
//! Actor, ActorBox,
|
//! Actor, ActorBox,
|
||||||
//! },
|
//! },
|
||||||
|
//! ext::Ext,
|
||||||
//! object::{
|
//! object::{
|
||||||
//! properties::{ApObjectProperties, ObjectProperties},
|
//! properties::{ApObjectProperties, ObjectProperties},
|
||||||
//! Object, ObjectBox,
|
//! Object, ObjectBox,
|
||||||
//! },
|
//! },
|
||||||
//! PropRefs,
|
//! Base, BaseBox, PropRefs,
|
||||||
//! };
|
//! };
|
||||||
//! use serde::{Deserialize, Serialize};
|
//! use serde::{Deserialize, Serialize};
|
||||||
//!
|
//!
|
||||||
//! #[derive(Clone, Debug, Serialize, Deserialize, PropRefs)]
|
//! #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)]
|
||||||
|
//! #[serde(transparent)]
|
||||||
|
//! pub struct ObjProps(pub ObjectProperties);
|
||||||
|
//!
|
||||||
|
//! #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)]
|
||||||
|
//! #[serde(transparent)]
|
||||||
|
//! pub struct ApObjProps(pub ApObjectProperties);
|
||||||
|
//!
|
||||||
|
//! #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)]
|
||||||
|
//! #[serde(transparent)]
|
||||||
|
//! pub struct ApActorProps(pub ApActorProperties);
|
||||||
|
//!
|
||||||
|
//! #[derive(Clone, Debug, Default, Serialize, Deserialize, PropRefs)]
|
||||||
//! #[serde(rename_all = "camelCase")]
|
//! #[serde(rename_all = "camelCase")]
|
||||||
//! #[prop_refs(Object)]
|
//! #[prop_refs(Object)]
|
||||||
//! #[prop_refs(Actor)]
|
//! #[prop_refs(Actor)]
|
||||||
|
@ -48,15 +61,15 @@
|
||||||
//!
|
//!
|
||||||
//! #[serde(flatten)]
|
//! #[serde(flatten)]
|
||||||
//! #[prop_refs]
|
//! #[prop_refs]
|
||||||
//! pub object_props: ObjectProperties,
|
//! pub object_props: ObjProps,
|
||||||
//!
|
//!
|
||||||
//! #[serde(flatten)]
|
//! #[serde(flatten)]
|
||||||
//! #[prop_refs]
|
//! #[prop_refs]
|
||||||
//! pub ap_object_props: ApObjectProperties,
|
//! pub ap_object_props: ApObjProps,
|
||||||
//!
|
//!
|
||||||
//! #[serde(flatten)]
|
//! #[serde(flatten)]
|
||||||
//! #[prop_refs]
|
//! #[prop_refs]
|
||||||
//! pub actor_props: ApActorProperties,
|
//! pub actor_props: ApActorProps,
|
||||||
//! }
|
//! }
|
||||||
//! #
|
//! #
|
||||||
//! # fn main() {}
|
//! # fn main() {}
|
||||||
|
|
|
@ -26,7 +26,7 @@ pub mod properties;
|
||||||
#[cfg(feature = "types")]
|
#[cfg(feature = "types")]
|
||||||
mod types;
|
mod types;
|
||||||
|
|
||||||
#[cfg(features = "types")]
|
#[cfg(feature = "types")]
|
||||||
pub use self::types::{
|
pub use self::types::{
|
||||||
OrderedCollection, OrderedCollectionPage, UnorderedCollection, UnorderedCollectionPage,
|
OrderedCollection, OrderedCollectionPage, UnorderedCollection, UnorderedCollectionPage,
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,15 +27,24 @@
|
||||||
//! properties::CollectionProperties,
|
//! properties::CollectionProperties,
|
||||||
//! Collection, CollectionBox,
|
//! Collection, CollectionBox,
|
||||||
//! },
|
//! },
|
||||||
|
//! ext::Ext,
|
||||||
//! object::{
|
//! object::{
|
||||||
//! properties::ObjectProperties,
|
//! properties::ObjectProperties,
|
||||||
//! Object, ObjectBox,
|
//! Object, ObjectBox,
|
||||||
//! },
|
//! },
|
||||||
//! PropRefs,
|
//! Base, BaseBox, PropRefs,
|
||||||
//! };
|
//! };
|
||||||
//! use serde::{Deserialize, Serialize};
|
//! use serde::{Deserialize, Serialize};
|
||||||
//!
|
//!
|
||||||
//! #[derive(Clone, Debug, Serialize, Deserialize, PropRefs)]
|
//! #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)]
|
||||||
|
//! #[serde(transparent)]
|
||||||
|
//! pub struct ObjProps(pub ObjectProperties);
|
||||||
|
//!
|
||||||
|
//! #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)]
|
||||||
|
//! #[serde(transparent)]
|
||||||
|
//! pub struct CollectionProps(pub CollectionProperties);
|
||||||
|
//!
|
||||||
|
//! #[derive(Clone, Debug, Default, Serialize, Deserialize, PropRefs)]
|
||||||
//! #[serde(rename_all = "camelCase")]
|
//! #[serde(rename_all = "camelCase")]
|
||||||
//! #[prop_refs(Object)]
|
//! #[prop_refs(Object)]
|
||||||
//! #[prop_refs(Collection)]
|
//! #[prop_refs(Collection)]
|
||||||
|
@ -48,11 +57,11 @@
|
||||||
//!
|
//!
|
||||||
//! #[serde(flatten)]
|
//! #[serde(flatten)]
|
||||||
//! #[prop_refs]
|
//! #[prop_refs]
|
||||||
//! pub object_properties: ObjectProperties,
|
//! pub object_properties: ObjProps,
|
||||||
//!
|
//!
|
||||||
//! #[serde(flatten)]
|
//! #[serde(flatten)]
|
||||||
//! #[prop_refs]
|
//! #[prop_refs]
|
||||||
//! pub collection_properties: CollectionProperties,
|
//! pub collection_properties: CollectionProps,
|
||||||
//! }
|
//! }
|
||||||
//! #
|
//! #
|
||||||
//! # fn main() {}
|
//! # fn main() {}
|
||||||
|
|
16
src/lib.rs
16
src/lib.rs
|
@ -267,6 +267,8 @@
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use activitystreams::{
|
//! use activitystreams::{
|
||||||
//! context,
|
//! context,
|
||||||
|
//! actor::{Actor, ActorBox},
|
||||||
|
//! ext::Ext,
|
||||||
//! object::{
|
//! object::{
|
||||||
//! properties::{
|
//! properties::{
|
||||||
//! ObjectProperties,
|
//! ObjectProperties,
|
||||||
|
@ -276,9 +278,8 @@
|
||||||
//! Object,
|
//! Object,
|
||||||
//! ObjectBox,
|
//! ObjectBox,
|
||||||
//! },
|
//! },
|
||||||
//! actor::{Actor, ActorBox},
|
|
||||||
//! primitives::XsdAnyUri,
|
//! primitives::XsdAnyUri,
|
||||||
//! PropRefs,
|
//! Base, BaseBox, PropRefs,
|
||||||
//! };
|
//! };
|
||||||
//! use serde::{Deserialize, Serialize};
|
//! use serde::{Deserialize, Serialize};
|
||||||
//!
|
//!
|
||||||
|
@ -320,11 +321,12 @@
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use activitystreams::{
|
//! use activitystreams::{
|
||||||
//! properties,
|
//! properties,
|
||||||
|
//! ext::Ext,
|
||||||
//! link::{
|
//! link::{
|
||||||
//! properties::LinkProperties,
|
//! properties::LinkProperties,
|
||||||
//! Link, LinkBox, Mention,
|
//! Link, LinkBox, Mention,
|
||||||
//! },
|
//! },
|
||||||
//! PropRefs,
|
//! Base, BaseBox, PropRefs,
|
||||||
//! UnitString,
|
//! UnitString,
|
||||||
//! };
|
//! };
|
||||||
//! use serde::{Deserialize, Serialize};
|
//! use serde::{Deserialize, Serialize};
|
||||||
|
@ -357,6 +359,10 @@
|
||||||
//! }
|
//! }
|
||||||
//! }
|
//! }
|
||||||
//!
|
//!
|
||||||
|
//! #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)]
|
||||||
|
//! #[serde(transparent)]
|
||||||
|
//! pub struct MyLinkProps(pub LinkProperties);
|
||||||
|
//!
|
||||||
//! /// Using the Properties derive macro
|
//! /// Using the Properties derive macro
|
||||||
//! ///
|
//! ///
|
||||||
//! /// This macro generates getters and setters for the associated fields.
|
//! /// This macro generates getters and setters for the associated fields.
|
||||||
|
@ -371,9 +377,9 @@
|
||||||
//! #[prop_refs]
|
//! #[prop_refs]
|
||||||
//! pub my_properties: MyProperties,
|
//! pub my_properties: MyProperties,
|
||||||
//!
|
//!
|
||||||
//! /// Derive AsRef/AsMut/Link for My -> LinkProperties
|
//! /// Derive AsRef/AsMut/Link for My -> MyLinkProperties
|
||||||
//! #[prop_refs]
|
//! #[prop_refs]
|
||||||
//! pub link_properties: LinkProperties,
|
//! pub link_properties: MyLinkProps,
|
||||||
//! }
|
//! }
|
||||||
//!
|
//!
|
||||||
//! fn main() -> Result<(), anyhow::Error> {
|
//! fn main() -> Result<(), anyhow::Error> {
|
||||||
|
|
|
@ -23,15 +23,20 @@
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use activitystreams::{
|
//! use activitystreams::{
|
||||||
|
//! ext::Ext,
|
||||||
//! link::{
|
//! link::{
|
||||||
//! properties::LinkProperties,
|
//! properties::LinkProperties,
|
||||||
//! Link, LinkBox,
|
//! Link, LinkBox,
|
||||||
//! },
|
//! },
|
||||||
//! PropRefs,
|
//! Base, BaseBox, PropRefs,
|
||||||
//! };
|
//! };
|
||||||
//! use serde::{Deserialize, Serialize};
|
//! use serde::{Deserialize, Serialize};
|
||||||
//!
|
//!
|
||||||
//! #[derive(Clone, Debug, Serialize, Deserialize, PropRefs)]
|
//! #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)]
|
||||||
|
//! #[serde(transparent)]
|
||||||
|
//! pub struct MyProps(pub LinkProperties);
|
||||||
|
//!
|
||||||
|
//! #[derive(Clone, Debug, Default, Serialize, Deserialize, PropRefs)]
|
||||||
//! #[serde(rename_all = "camelCase")]
|
//! #[serde(rename_all = "camelCase")]
|
||||||
//! #[prop_refs(Link)]
|
//! #[prop_refs(Link)]
|
||||||
//! pub struct MyLink {
|
//! pub struct MyLink {
|
||||||
|
@ -43,7 +48,7 @@
|
||||||
//!
|
//!
|
||||||
//! #[serde(flatten)]
|
//! #[serde(flatten)]
|
||||||
//! #[prop_refs]
|
//! #[prop_refs]
|
||||||
//! pub link_properties: LinkProperties,
|
//! pub link_properties: MyProps,
|
||||||
//! }
|
//! }
|
||||||
//! #
|
//! #
|
||||||
//! # fn main() {}
|
//! # fn main() {}
|
||||||
|
|
|
@ -23,15 +23,20 @@
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use activitystreams::{
|
//! use activitystreams::{
|
||||||
|
//! ext::Ext,
|
||||||
//! object::{
|
//! object::{
|
||||||
//! properties::ObjectProperties,
|
//! properties::ObjectProperties,
|
||||||
//! Object, ObjectBox,
|
//! Object, ObjectBox,
|
||||||
//! },
|
//! },
|
||||||
//! Base, BaseBox, PropRefs,
|
//! Base, BaseBox, PropRefs,
|
||||||
//! };
|
//! };
|
||||||
//! use serde::{Deserialize, Serialize};
|
//! use std::collections::HashMap;
|
||||||
//!
|
//!
|
||||||
//! #[derive(Clone, Debug, Serialize, Deserialize, PropRefs)]
|
//! #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)]
|
||||||
|
//! #[serde(transparent)]
|
||||||
|
//! pub struct MyProps(pub ObjectProperties);
|
||||||
|
//!
|
||||||
|
//! #[derive(Clone, Debug, Default, PropRefs, serde::Serialize, serde::Deserialize)]
|
||||||
//! #[serde(rename_all = "camelCase")]
|
//! #[serde(rename_all = "camelCase")]
|
||||||
//! #[prop_refs(Object)]
|
//! #[prop_refs(Object)]
|
||||||
//! pub struct MyObject {
|
//! pub struct MyObject {
|
||||||
|
@ -43,7 +48,7 @@
|
||||||
//!
|
//!
|
||||||
//! #[serde(flatten)]
|
//! #[serde(flatten)]
|
||||||
//! #[prop_refs]
|
//! #[prop_refs]
|
||||||
//! pub object_properties: ObjectProperties,
|
//! pub extra: MyProps,
|
||||||
//! }
|
//! }
|
||||||
//! #
|
//! #
|
||||||
//! # fn main() {}
|
//! # fn main() {}
|
||||||
|
|
Loading…
Reference in a new issue