Skip to content

Commit 44598b8

Browse files
bors[bot]CAD97WaffleLapkin
authored
Merge #74 #76
74: Fix CI docs deploy r=CAD97 a=CAD97 bors: r+ 🤖 76: Implement `TryFrom<Pin<$Rc<T>>> for Pin<$RcBox<T>>` r=CAD97 a=WaffleLapkin This allows to construct a pinned rc-box from a pinned rc. I found myself wanting to use `ArcBox` with `dyn Stream` and well... it's weird. Co-authored-by: Christopher Durham <cad97@cad97.com> Co-authored-by: Maybe Waffle <waffle.lapkin@gmail.com>
3 parents 94c3cbc + 2ed1eb7 + afcaba9 commit 44598b8

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

.github/workflows/rustdoc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ jobs:
3232
with:
3333
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
3434
github_token: ${{ github.token }}
35-
public_dir: ./target/doc
35+
publish_dir: ./target/doc
3636
force_orphan: true

crates/rc-box/src/lib.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,19 @@ macro_rules! rc_box {
8484
}
8585
}
8686

87+
impl<T: ?Sized> TryFrom<Pin<$Rc<T>>> for Pin<$RcBox<T>> {
88+
type Error = Pin<$Rc<T>>;
89+
fn try_from(v: Pin<$Rc<T>>) -> Result<Pin<$RcBox<T>>, Pin<$Rc<T>>> {
90+
unsafe {
91+
let v = Pin::into_inner_unchecked(v);
92+
match $RcBox::<T>::try_from(v) {
93+
Ok(this) => Ok(Pin::new_unchecked(this)),
94+
Err(v) => Err(Pin::new_unchecked(v)),
95+
}
96+
}
97+
}
98+
}
99+
87100
impl<T: ?Sized> $RcBox<T> {
88101
unsafe fn from_unchecked<V>(v: V) -> Self
89102
where

0 commit comments

Comments
 (0)