Crates.io | sdp-rs |
lib.rs | sdp-rs |
version | 0.2.1 |
source | src |
created_at | 2022-05-14 16:56:10.399541 |
updated_at | 2022-06-19 12:07:34.917 |
description | SDP Rust library, parser & generator of the Session Description Protocol |
homepage | |
repository | https://github.com/televiska/sdp-rs |
max_upload_size | |
id | 586714 |
size | 167,605 |
A common general purpose library for SDP. It can parse and generate all SDP structures. Supports both RFC8866 and RFC4566.
Like rsip, this crate is a general purpose library for
common types found when working with the SDP protocol.
You will find high level types like the SessionDescription
, MediaDescription
and Time
but you
will also find line-level types like Connection
or even types found inside a line, like Bwtype
etc.
sdp-rs
is capable of parsing messages from &str or String using nom
parser and can also generate SDP messages using the main SessionDescription
struct. Each type
(high level type, line type or sub-line type) can be parsed or be displayed as it would,
so you can work with part of an SDP message, if that's useful for you.
If you need parsing raw bytes (&[u8]
) ping us. It is possible but we avoided doing that in the
first place because a) it requires tons of traits/generics which will increase complexity and
compile times b) SDP specification highly recommends that the input is UTF-8 c) performance of
converting the bytes to UTF-8 should be negligible.
Each type in sdp-rs
has a related tokenizer.
This is not enforced by the type system yet, however very soon this will be the case.
In brief, for every sdp-rs
type we have:
Tokenizer
which is capable of tokenizing the input.
All common tokenizers accept the &str
input. You shouldn't have to work directly with the
tokenizers, these are being used indirectly in the parsing level.TryFrom
impls from the
relevant type tokenizer to the actual type. This is the parsing step where tokens (in the form of
&str
) are transformed to integers, strings or sdp-rs
types.sdp-rs
type implements the Display
trait and hence has a representation.