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