activitystreams/activitystreams-types/README.md

47 lines
1.8 KiB
Markdown
Raw Normal View History

2018-05-14 06:18:12 +00:00
# ActivityStreams Types
__A base set of types from the Activity Streams specification.__
2019-07-30 22:02:05 +00:00
- [Read the documentation on docs.rs](https://docs.rs/activitystreams-types)
- [Find the crate on crates.io](https://crates.io/crates/activitystreams-types)
2020-03-10 16:48:54 +00:00
- [Hit me up on Mastodon](https://asonix.dog/@asonix)
2019-07-30 22:02:05 +00:00
2018-05-14 06:18:12 +00:00
## Usage
2020-03-10 16:48:54 +00:00
First, add the crate to your `Cargo.toml`
2018-05-14 06:18:12 +00:00
```toml
# Cargo.toml
2020-03-10 16:48:54 +00:00
activitystreams-types = "0.4"
2018-05-14 06:18:12 +00:00
```
Then use it in your project!
```rust
// in your project
use activitystreams_types::{context, link::Mention};
2020-03-10 16:48:54 +00:00
fn run() -> Result<(), Box<dyn std::error::Error>> {
2018-05-14 06:18:12 +00:00
/// A Mention is the only predefined Link type in the Activity Streams spec
let mut mention = Mention::default();
2020-03-10 16:48:54 +00:00
mention.as_ref().set_context_xsd_any_uri(context())?;
2018-05-14 06:18:12 +00:00
let mention_string = serde_json::to_string(&mention)?;
let mention: Mention = serde_json::from_str(&mention_string)?;
Ok(())
}
```
## Contributing
Feel free to open issues for anything you find an issue with. Please note that any contributed code will be licensed under the GPLv3.
## License
2020-03-10 16:48:54 +00:00
Copyright © 2020 Riley Trautman
2018-05-14 06:18:12 +00:00
ActivityStreams Types 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 Types 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. This file is part of ActivityStreams Types.
You should have received a copy of the GNU General Public License along with ActivityStreams Types. If not, see [http://www.gnu.org/licenses/](http://www.gnu.org/licenses/).