Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
03d300fc
提交
03d300fc
authored
7月 27, 2021
作者:
Nazar Mokrynskyi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move transport cloning into private module to make it unreachable externally
上级
ce31fb42
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
23 行增加
和
21 行删除
+23
-21
transport.rs
rust/src/router/transport.rs
+23
-21
没有找到文件。
rust/src/router/transport.rs
浏览文件 @
03d300fc
...
@@ -40,6 +40,27 @@ uuid_based_wrapper_type!(
...
@@ -40,6 +40,27 @@ uuid_based_wrapper_type!(
TransportId
TransportId
);
);
// We don't want this to be a public API, but have to use it like this to be able to still use as
// trait object
mod
private
{
use
super
::
Transport
;
#[doc(hidden)]
pub
trait
CloneTransport
{
#[doc(hidden)]
fn
clone_box
(
&
self
)
->
Box
<
dyn
Transport
>
;
}
impl
<
T
>
CloneTransport
for
T
where
T
:
Transport
+
Clone
+
'static
,
{
fn
clone_box
(
&
self
)
->
Box
<
dyn
Transport
>
{
Box
::
new
(
self
.clone
())
}
}
}
/// Data contained in transport trace events.
/// Data contained in transport trace events.
///
///
/// See also "trace" event in the [Debugging](https://mediasoup.org/documentation/v3/mediasoup/debugging#trace-Event)
/// See also "trace" event in the [Debugging](https://mediasoup.org/documentation/v3/mediasoup/debugging#trace-Event)
...
@@ -128,7 +149,7 @@ pub(super) enum TransportType {
...
@@ -128,7 +149,7 @@ pub(super) enum TransportType {
///
///
/// For additional methods see [`TransportGeneric`].
/// For additional methods see [`TransportGeneric`].
#[async_trait(
?
Send)]
#[async_trait(
?
Send)]
pub
trait
Transport
:
Debug
+
Send
+
Sync
+
CloneTransport
{
pub
trait
Transport
:
Debug
+
Send
+
Sync
+
private
::
CloneTransport
{
/// Transport id.
/// Transport id.
#[must_use]
#[must_use]
fn
id
(
&
self
)
->
TransportId
;
fn
id
(
&
self
)
->
TransportId
;
...
@@ -253,28 +274,9 @@ pub trait Transport: Debug + Send + Sync + CloneTransport {
...
@@ -253,28 +274,9 @@ pub trait Transport: Debug + Send + Sync + CloneTransport {
fn
on_close
(
&
self
,
callback
:
Box
<
dyn
FnOnce
()
+
Send
+
'static
>
)
->
HandlerId
;
fn
on_close
(
&
self
,
callback
:
Box
<
dyn
FnOnce
()
+
Send
+
'static
>
)
->
HandlerId
;
}
}
// We don't want this to be a public API, but have to use it like this to be able to still use as
// trait object
/// This is a private method, don't use it outside of the library
#[doc(hidden)]
pub
trait
CloneTransport
{
/// This is a private method, don't use it outside of the library
#[doc(hidden)]
fn
clone_transport
(
&
self
)
->
Box
<
dyn
Transport
>
;
}
impl
<
T
>
CloneTransport
for
T
where
T
:
Transport
+
Clone
+
'static
,
{
fn
clone_transport
(
&
self
)
->
Box
<
dyn
Transport
>
{
Box
::
new
(
self
.clone
())
}
}
impl
Clone
for
Box
<
dyn
Transport
>
{
impl
Clone
for
Box
<
dyn
Transport
>
{
fn
clone
(
&
self
)
->
Self
{
fn
clone
(
&
self
)
->
Self
{
self
.clone_
transport
()
self
.clone_
box
()
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论