mirror of https://github.com/fafhrd91/actix-web
RustFmt and Docu
This commit is contained in:
parent
3afe132088
commit
5acc78e9f7
|
@ -5,6 +5,7 @@
|
||||||
* Add `TrailingSlash::MergeOnly` behaviour to `NormalizePath`, which allow `NormalizePath`
|
* Add `TrailingSlash::MergeOnly` behaviour to `NormalizePath`, which allow `NormalizePath`
|
||||||
to keep the trailing slash's existance as it is. [#1695]
|
to keep the trailing slash's existance as it is. [#1695]
|
||||||
* Fix `ResourceMap` recursive references when printing/debugging. [#1708]
|
* Fix `ResourceMap` recursive references when printing/debugging. [#1708]
|
||||||
|
* Remove bound `std::marker::Sized` from `web::Data` to support storing `Arc<dyn Trait>` via `web::Data::from` [#1710]
|
||||||
|
|
||||||
[#1708]: https://github.com/actix/actix-web/pull/1708
|
[#1708]: https://github.com/actix/actix-web/pull/1708
|
||||||
|
|
||||||
|
|
|
@ -300,17 +300,17 @@ mod tests {
|
||||||
fn get_num(&self) -> i32;
|
fn get_num(&self) -> i32;
|
||||||
}
|
}
|
||||||
struct A {}
|
struct A {}
|
||||||
impl TestTrait for A{
|
impl TestTrait for A {
|
||||||
fn get_num(&self) -> i32 {
|
fn get_num(&self) -> i32 {
|
||||||
42
|
42
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// This works when Sized is required
|
// This works when Sized is required
|
||||||
let dyn_arc_box: Arc<Box<dyn TestTrait>> = Arc::new(Box::new(A{}));
|
let dyn_arc_box: Arc<Box<dyn TestTrait>> = Arc::new(Box::new(A {}));
|
||||||
let data_arc_box = Data::from(dyn_arc_box);
|
let data_arc_box = Data::from(dyn_arc_box);
|
||||||
// This works when Data Sized Bound is removed
|
// This works when Data Sized Bound is removed
|
||||||
let dyn_arc: Arc<dyn TestTrait> = Arc::new(A{});
|
let dyn_arc: Arc<dyn TestTrait> = Arc::new(A {});
|
||||||
let data_arc = Data::from(dyn_arc);
|
let data_arc = Data::from(dyn_arc);
|
||||||
assert_eq!(data_arc_box.get_num(), data_arc.get_num())
|
assert_eq!(data_arc_box.get_num(), data_arc.get_num())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue