pub struct BroadcastTicket { /* private fields */ }Expand description
A publisher’s endpoint id and the path of one of its broadcasts.
The string form is ilv1:<peer>/<path>. <peer> is the endpoint id in
lowercase base32. Any segment of the path that equals the peer’s own id is
written as ~, and every other byte outside [A-Za-z0-9._-] is
percent-encoded. Parsing accepts the id in base32 of either case, or in
lowercase hex. Serde uses the string form.
A ticket says nothing about layouts: the path is whatever the publisher published at.
§Examples
use iroh_live_node::BroadcastTicket;
use moq_net::Path;
let peer = iroh::SecretKey::generate().public();
let path = Path::new(&format!("live/{peer}/studio"))?;
let ticket = BroadcastTicket::at(peer, path);
assert!(ticket.to_string().ends_with("/live/~/studio"));
let parsed: BroadcastTicket = ticket.to_string().parse()?;
assert_eq!(parsed, ticket);Implementations§
Source§impl BroadcastTicket
impl BroadcastTicket
Sourcepub const MAX_LEN: usize = 4000
pub const MAX_LEN: usize = 4000
The most bytes a ticket string may have.
A media relay mounts the string as one path, and moq allows 4096 bytes in one.
Sourcepub const MAX_PARTS: usize = 31
pub const MAX_PARTS: usize = 31
The most path segments a ticket may have.
A media relay mounts the string as one more segment, and moq allows 32.
Sourcepub fn at(peer: EndpointId, path: Path) -> Self
pub fn at(peer: EndpointId, path: Path) -> Self
Creates a ticket for the broadcast at path of peer.
A path that is too long for the string form still displays, but does not parse back.
Sourcepub fn peer(&self) -> EndpointId
pub fn peer(&self) -> EndpointId
Returns the publisher’s endpoint id.
Trait Implementations§
Source§impl Clone for BroadcastTicket
impl Clone for BroadcastTicket
Source§impl Debug for BroadcastTicket
impl Debug for BroadcastTicket
Source§impl<'de> Deserialize<'de> for BroadcastTicket
impl<'de> Deserialize<'de> for BroadcastTicket
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl Display for BroadcastTicket
impl Display for BroadcastTicket
impl Eq for BroadcastTicket
Source§impl FromStr for BroadcastTicket
impl FromStr for BroadcastTicket
Source§impl Hash for BroadcastTicket
impl Hash for BroadcastTicket
Source§impl PartialEq for BroadcastTicket
impl PartialEq for BroadcastTicket
Source§impl Serialize for BroadcastTicket
impl Serialize for BroadcastTicket
impl StructuralPartialEq for BroadcastTicket
Auto Trait Implementations§
impl Freeze for BroadcastTicket
impl RefUnwindSafe for BroadcastTicket
impl Send for BroadcastTicket
impl Sync for BroadcastTicket
impl Unpin for BroadcastTicket
impl UnsafeUnpin for BroadcastTicket
impl UnwindSafe for BroadcastTicket
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.