moq-transport: Make Messages and Objects Clone (#57)
This commit is contained in:
parent
5423d7c93a
commit
fdc05ffb99
|
@ -2,7 +2,7 @@ use crate::coding::{decode_string, encode_string, DecodeError, EncodeError};
|
||||||
|
|
||||||
use webtransport_generic::{RecvStream, SendStream};
|
use webtransport_generic::{RecvStream, SendStream};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Announce {
|
pub struct Announce {
|
||||||
// The track namespace
|
// The track namespace
|
||||||
pub track_namespace: String,
|
pub track_namespace: String,
|
||||||
|
|
|
@ -2,7 +2,7 @@ use crate::coding::{decode_string, encode_string, DecodeError, EncodeError, VarI
|
||||||
|
|
||||||
use webtransport_generic::{RecvStream, SendStream};
|
use webtransport_generic::{RecvStream, SendStream};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct AnnounceError {
|
pub struct AnnounceError {
|
||||||
// Echo back the namespace that was announced.
|
// Echo back the namespace that was announced.
|
||||||
// TODO Propose using an ID to save bytes.
|
// TODO Propose using an ID to save bytes.
|
||||||
|
|
|
@ -2,7 +2,7 @@ use crate::coding::{decode_string, encode_string, DecodeError, EncodeError};
|
||||||
|
|
||||||
use webtransport_generic::{RecvStream, SendStream};
|
use webtransport_generic::{RecvStream, SendStream};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct AnnounceOk {
|
pub struct AnnounceOk {
|
||||||
// Echo back the namespace that was announced.
|
// Echo back the namespace that was announced.
|
||||||
// TODO Propose using an ID to save bytes.
|
// TODO Propose using an ID to save bytes.
|
||||||
|
|
|
@ -2,7 +2,7 @@ use crate::coding::{decode_string, encode_string, DecodeError, EncodeError};
|
||||||
|
|
||||||
use webtransport_generic::{RecvStream, SendStream};
|
use webtransport_generic::{RecvStream, SendStream};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct GoAway {
|
pub struct GoAway {
|
||||||
pub url: String,
|
pub url: String,
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ use webtransport_generic::{RecvStream, SendStream};
|
||||||
// This implements a decode/encode method that uses the specified type.
|
// This implements a decode/encode method that uses the specified type.
|
||||||
macro_rules! message_types {
|
macro_rules! message_types {
|
||||||
{$($name:ident = $val:expr,)*} => {
|
{$($name:ident = $val:expr,)*} => {
|
||||||
|
#[derive(Clone)]
|
||||||
pub enum Message {
|
pub enum Message {
|
||||||
$($name($name)),*
|
$($name($name)),*
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ use crate::coding::{decode_string, encode_string, DecodeError, EncodeError, VarI
|
||||||
|
|
||||||
use webtransport_generic::{RecvStream, SendStream};
|
use webtransport_generic::{RecvStream, SendStream};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Subscribe {
|
pub struct Subscribe {
|
||||||
// An ID we choose so we can map to the track_name.
|
// An ID we choose so we can map to the track_name.
|
||||||
// Proposal: https://github.com/moq-wg/moq-transport/issues/209
|
// Proposal: https://github.com/moq-wg/moq-transport/issues/209
|
||||||
|
|
|
@ -2,7 +2,7 @@ use crate::coding::{decode_string, encode_string, DecodeError, EncodeError, VarI
|
||||||
|
|
||||||
use webtransport_generic::{RecvStream, SendStream};
|
use webtransport_generic::{RecvStream, SendStream};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct SubscribeError {
|
pub struct SubscribeError {
|
||||||
// NOTE: No full track name because of this proposal: https://github.com/moq-wg/moq-transport/issues/209
|
// NOTE: No full track name because of this proposal: https://github.com/moq-wg/moq-transport/issues/209
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ use crate::coding::{DecodeError, EncodeError, VarInt};
|
||||||
|
|
||||||
use webtransport_generic::{RecvStream, SendStream};
|
use webtransport_generic::{RecvStream, SendStream};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct SubscribeOk {
|
pub struct SubscribeOk {
|
||||||
// NOTE: No full track name because of this proposal: https://github.com/moq-wg/moq-transport/issues/209
|
// NOTE: No full track name because of this proposal: https://github.com/moq-wg/moq-transport/issues/209
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ use crate::coding::{DecodeError, EncodeError, VarInt};
|
||||||
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||||
use webtransport_generic::{RecvStream, SendStream};
|
use webtransport_generic::{RecvStream, SendStream};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Object {
|
pub struct Object {
|
||||||
// An ID for this track.
|
// An ID for this track.
|
||||||
// Proposal: https://github.com/moq-wg/moq-transport/issues/209
|
// Proposal: https://github.com/moq-wg/moq-transport/issues/209
|
||||||
|
|
Loading…
Reference in New Issue