Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Arti
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jill
Arti
Commits
0846ebd6
Commit
0846ebd6
authored
3 years ago
by
Ian Jackson
Browse files
Options
Downloads
Patches
Plain Diff
Make DirFilter be Debug + Send + Sync
Abolish the handwritten Debug impl for DynFilter, which is no longer needed.
parent
123cd222
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
crates/arti-client/src/builder.rs
+1
-1
1 addition, 1 deletion
crates/arti-client/src/builder.rs
crates/tor-dirmgr/src/filter.rs
+4
-8
4 additions, 8 deletions
crates/tor-dirmgr/src/filter.rs
with
5 additions
and
9 deletions
crates/arti-client/src/builder.rs
+
1
−
1
View file @
0846ebd6
...
...
@@ -113,7 +113,7 @@ impl<R: Runtime> TorClientBuilder<R> {
#[cfg(feature
=
"dirfilter"
)]
pub
fn
dirfilter
<
F
>
(
mut
self
,
filter
:
F
)
->
Self
where
F
:
tor_dirmgr
::
filter
::
DirFilter
+
Send
+
Sync
+
'static
,
F
:
tor_dirmgr
::
filter
::
DirFilter
+
'static
,
{
self
.dirfilter
=
Some
(
tor_dirmgr
::
filter
::
DynFilter
::
new
(
filter
));
self
...
...
This diff is collapsed.
Click to expand it.
crates/tor-dirmgr/src/filter.rs
+
4
−
8
View file @
0846ebd6
...
...
@@ -7,6 +7,7 @@
//! future versions, or its API might change completely. There are no semver
//! guarantees.
use
std
::
fmt
::
Debug
;
use
std
::
sync
::
Arc
;
use
crate
::
Result
;
...
...
@@ -16,7 +17,7 @@ use tor_netdoc::doc::{microdesc::Microdesc, netstatus::UncheckedMdConsensus};
///
/// Instances of DirFilter can be used for testing, to modify directory data
/// on-the-fly.
pub
trait
DirFilter
{
pub
trait
DirFilter
:
Debug
+
Send
+
Sync
{
/// Modify `consensus` in an unspecified way.
fn
filter_consensus
(
&
self
,
consensus
:
UncheckedMdConsensus
)
->
Result
<
UncheckedMdConsensus
>
;
/// Modify `md` in an unspecified way.
...
...
@@ -24,7 +25,7 @@ pub trait DirFilter {
}
/// A dynamic [`DirFilter`] instance.
#[derive(Clone)]
#[derive(Clone
,
Debug
)]
pub
struct
DynFilter
{
/// A reference to the DirFilter object
filter
:
Arc
<
dyn
DirFilter
+
Send
+
Sync
>
,
...
...
@@ -64,13 +65,8 @@ impl DirFilter for DynFilter {
}
}
impl
std
::
fmt
::
Debug
for
DynFilter
{
fn
fmt
(
&
self
,
f
:
&
mut
std
::
fmt
::
Formatter
<
'_
>
)
->
std
::
fmt
::
Result
{
f
.debug_struct
(
"DynFilter"
)
.finish_non_exhaustive
()
}
}
/// A [`DirFilter`] that does nothing.
#[derive(Debug)]
struct
NilFilter
;
impl
DirFilter
for
NilFilter
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment