moq-transport: Make Messages and Objects Clone (#57)

This commit is contained in:
Mike English 2023-08-29 00:59:30 -04:00 committed by GitHub
parent 5423d7c93a
commit fdc05ffb99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 9 additions and 8 deletions

View File

@ -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,

View File

@ -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.

View File

@ -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.

View File

@ -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,
} }

View File

@ -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)),*
} }

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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