Crates.io | matrix_uri |
lib.rs | matrix_uri |
version | 0.1.1 |
source | src |
created_at | 2021-03-17 15:01:52.348099 |
updated_at | 2022-03-28 10:40:38.06303 |
description | A crate for parsing Matrix URIs according to both matrix.to and MSC2312 |
homepage | https://famedly.com/ |
repository | https://gitlab.com/famedly/libraries/matrix_uri |
max_upload_size | |
id | 370162 |
size | 61,159 |
Coverage | Pipeline |
---|---|
Ruma has support for parsing both types of Matrix URIs as of version 0.5.0
, thus this crate is now deprecated.
A crate for building and parsing Matrix URIs according to both the matrix.to specification and also MSC2312 (matrix://
).
Optionally provides conversion to types from ruma_identifiers
with the ruma
feature
let uri = crate::MatrixUri::new(
crate::MatrixId::new(crate::IdType::UserId, String::from("cute:some.url")),
None,
None,
Some(vec![String::from("headpat.services"), String::from("cute.local")]),
Some(crate::MatrixUriAction::Chat),
)
.unwrap();
println!("{} with {}", uri.action().unwrap().to_string(), uri.mxid.to_string()); // `chat with @cute:some.url`
println!("{}", uri.matrix_uri_string()); // `matrix:u/cute%3Asome.url?action=chat&via=headpat.services&via=cute.local`
println!("{}", uri.matrix_to_string()); // `https://matrix.to/#/%40cute%3Asome.url?action=chat&via=headpat.services&via=cute.local`
let uri = matrix_uri::MatrixUri::from_str("matrix:u/her:example.org?action=chat").unwrap();
println!("{} - {:?}", uri.mxid.to_string(), uri.action().unwrap()); // `@her:example.org - Chat`
Can be viewed from source by running cargo doc --open
pip install --user pre-commit
pre-commit autoupdate
to update the pre-commit config to use the newest templatepre-commit install
to install the pre-commit hooks to your local environment