Skip to content

Commit

Permalink
Merge pull request #824 from jplatte/box-raw-value-to-underlying
Browse files Browse the repository at this point in the history
Add impl From<Box<RawValue>> for Box<str>
  • Loading branch information
dtolnay committed Nov 17, 2021
2 parents 584f476 + 37fe6b5 commit dee8161
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/raw.rs
Expand Up @@ -216,6 +216,12 @@ impl RawValue {
}
}

impl From<Box<RawValue>> for Box<str> {
fn from(val: Box<RawValue>) -> Self {
unsafe { mem::transmute::<Box<RawValue>, Box<str>>(val) }
}
}

/// Convert a `T` into a boxed `RawValue`.
///
/// # Example
Expand Down

0 comments on commit dee8161

Please sign in to comment.