diff --git a/src/deprecated.rs b/src/deprecated.rs index a1e8e2f5c4..31d3251399 100644 --- a/src/deprecated.rs +++ b/src/deprecated.rs @@ -12,12 +12,54 @@ use super::*; +impl Ref +where + B: ByteSlice, + T: KnownLayout + Immutable + ?Sized, +{ + #[deprecated(since = "0.8.0", note = "renamed to `Ref::from`")] + #[doc(hidden)] + #[must_use = "has no side effects"] + #[inline] + pub fn new(bytes: B) -> Result, CastError> { + Self::from(bytes) + } +} + +impl Ref +where + B: SplitByteSlice, + T: KnownLayout + Immutable + ?Sized, +{ + #[deprecated(since = "0.8.0", note = "renamed to `Ref::from_prefix`")] + #[doc(hidden)] + #[must_use = "has no side effects"] + #[inline] + pub fn new_from_prefix(bytes: B) -> Result<(Ref, B), CastError> { + Self::from_prefix(bytes) + } +} + +impl Ref +where + B: SplitByteSlice, + T: KnownLayout + Immutable + ?Sized, +{ + #[deprecated(since = "0.8.0", note = "renamed to `Ref::from_suffix`")] + #[doc(hidden)] + #[must_use = "has no side effects"] + #[inline] + pub fn new_from_suffix(bytes: B) -> Result<(B, Ref), CastError> { + Self::from_suffix(bytes) + } +} + impl Ref where B: ByteSlice, T: Immutable, { - #[deprecated(since = "0.8.0", note = "`Ref::new` now supports slices")] + #[deprecated(since = "0.8.0", note = "`Ref::from` now supports slices")] #[doc(hidden)] #[inline] pub fn new_slice(bytes: B) -> Option> { @@ -30,7 +72,7 @@ where B: ByteSlice, T: Unaligned + Immutable, { - #[deprecated(since = "0.8.0", note = "`Ref::new_unaligned` now supports slices")] + #[deprecated(since = "0.8.0", note = "`Ref::unaligned_from` now supports slices")] #[doc(hidden)] #[inline(always)] pub fn new_slice_unaligned(bytes: B) -> Option> {