2018-05-12 20:14:43 +00:00
|
|
|
/*
|
|
|
|
* This file is part of ActivityStreams.
|
|
|
|
*
|
|
|
|
* Copyright © 2018 Riley Trautman
|
|
|
|
*
|
|
|
|
* ActivityStreams is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* ActivityStreams is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2018-05-13 23:30:48 +00:00
|
|
|
//! Namespace for Unit Structs that serialize to strings
|
|
|
|
|
2018-05-12 19:35:10 +00:00
|
|
|
use std::fmt;
|
|
|
|
|
|
|
|
use serde::{
|
|
|
|
de::{self, Deserialize, Deserializer, Visitor}, ser::{Serialize, Serializer},
|
|
|
|
};
|
|
|
|
|
2018-05-13 23:30:48 +00:00
|
|
|
/// A Unit Struct that represents the string "Article"
|
2018-05-13 20:58:47 +00:00
|
|
|
#[derive(Clone, Debug, Default, UnitString)]
|
2018-05-12 19:35:10 +00:00
|
|
|
#[activitystreams(Article)]
|
|
|
|
pub struct ArticleType;
|
|
|
|
|
2018-05-13 23:30:48 +00:00
|
|
|
/// A Unit Struct that represents the string "Audio"
|
2018-05-13 20:58:47 +00:00
|
|
|
#[derive(Clone, Debug, Default, UnitString)]
|
2018-05-12 19:35:10 +00:00
|
|
|
#[activitystreams(Audio)]
|
|
|
|
pub struct AudioType;
|
|
|
|
|
2018-05-13 23:30:48 +00:00
|
|
|
/// A Unit Struct that represents the string "Document"
|
2018-05-13 20:58:47 +00:00
|
|
|
#[derive(Clone, Debug, Default, UnitString)]
|
2018-05-12 19:35:10 +00:00
|
|
|
#[activitystreams(Document)]
|
|
|
|
pub struct DocumentType;
|
|
|
|
|
2018-05-13 23:30:48 +00:00
|
|
|
/// A Unit Struct that represents the string "Event"
|
2018-05-13 20:58:47 +00:00
|
|
|
#[derive(Clone, Debug, Default, UnitString)]
|
2018-05-12 19:35:10 +00:00
|
|
|
#[activitystreams(Event)]
|
|
|
|
pub struct EventType;
|
|
|
|
|
2018-05-13 23:30:48 +00:00
|
|
|
/// A Unit Struct that represents the string "Image"
|
2018-05-13 20:58:47 +00:00
|
|
|
#[derive(Clone, Debug, Default, UnitString)]
|
2018-05-12 19:35:10 +00:00
|
|
|
#[activitystreams(Image)]
|
|
|
|
pub struct ImageType;
|
|
|
|
|
2018-05-13 23:30:48 +00:00
|
|
|
/// A Unit Struct that represents the string "Note"
|
2018-05-13 20:58:47 +00:00
|
|
|
#[derive(Clone, Debug, Default, UnitString)]
|
2018-05-12 19:35:10 +00:00
|
|
|
#[activitystreams(Note)]
|
|
|
|
pub struct NoteType;
|
|
|
|
|
2018-05-13 23:30:48 +00:00
|
|
|
/// A Unit Struct that represents the string "Page"
|
2018-05-13 20:58:47 +00:00
|
|
|
#[derive(Clone, Debug, Default, UnitString)]
|
2018-05-12 19:35:10 +00:00
|
|
|
#[activitystreams(Page)]
|
|
|
|
pub struct PageType;
|
|
|
|
|
2018-05-13 23:30:48 +00:00
|
|
|
/// A Unit Struct that represents the string "Place"
|
2018-05-13 20:58:47 +00:00
|
|
|
#[derive(Clone, Debug, Default, UnitString)]
|
2018-05-12 19:35:10 +00:00
|
|
|
#[activitystreams(Place)]
|
|
|
|
pub struct PlaceType;
|
|
|
|
|
2018-05-13 23:30:48 +00:00
|
|
|
/// A Unit Struct that represents the string "Profile"
|
2018-05-13 20:58:47 +00:00
|
|
|
#[derive(Clone, Debug, Default, UnitString)]
|
2018-05-12 19:35:10 +00:00
|
|
|
#[activitystreams(Profile)]
|
|
|
|
pub struct ProfileType;
|
|
|
|
|
2018-05-13 23:30:48 +00:00
|
|
|
/// A Unit Struct that represents the string "Relationship"
|
2018-05-13 20:58:47 +00:00
|
|
|
#[derive(Clone, Debug, Default, UnitString)]
|
2018-05-12 19:35:10 +00:00
|
|
|
#[activitystreams(Relationship)]
|
|
|
|
pub struct RelationshipType;
|
|
|
|
|
2018-05-13 23:30:48 +00:00
|
|
|
/// A Unit Struct that represents the string "Tombstone"
|
2018-05-13 20:58:47 +00:00
|
|
|
#[derive(Clone, Debug, Default, UnitString)]
|
2018-05-12 19:35:10 +00:00
|
|
|
#[activitystreams(Tombstone)]
|
|
|
|
pub struct TombstoneType;
|
|
|
|
|
2018-05-13 23:30:48 +00:00
|
|
|
/// A Unit Struct that represents the string "Video"
|
2018-05-13 20:58:47 +00:00
|
|
|
#[derive(Clone, Debug, Default, UnitString)]
|
2018-05-12 19:35:10 +00:00
|
|
|
#[activitystreams(Video)]
|
|
|
|
pub struct VideoType;
|