o3 0.62.0

shared-nothing primitives
Documentation
use crate::buffer::{
    self,
    bytes::bounded,
    storage::{self, provided},
};

// SAFETY: mutable access reborrows this exact slice while its slot edge remains in place.
unsafe impl<O> buffer::raw::Mutable for provided::raw::Slice<&mut [u8], O> where
    Self: buffer::raw::Source
{
}

// SAFETY: the prefix's shared access preserves its exact borrowed range and owner.
unsafe impl<T: buffer::raw::Source, L: provided::raw::Layout> buffer::raw::Source
    for provided::raw::Slice<T, &'_ provided::raw::Owner<'_, L>>
{
}

// SAFETY: Selection removes exactly the admitted prefix from the original slice;
// both disjoint borrows retain the unchanged provided owner and its lifetime.
unsafe impl<L: provided::raw::Layout> buffer::raw::Split
    for provided::raw::Slice<&'_ mut [u8], &'_ provided::raw::Owner<'_, L>>
{
}

// SAFETY: the bound forwards shared access to the same stable provided prefix.
unsafe impl<T: buffer::raw::Source, L: provided::raw::Layout> buffer::raw::Source
    for bounded::Value<provided::raw::Slice<T, &'_ provided::raw::Owner<'_, L>>>
{
}

// SAFETY: conversion moves the original byte borrow and provided owner unchanged.
unsafe impl<'a, 'd, L: provided::raw::Layout> buffer::raw::Freeze
    for provided::raw::Slice<&'a mut [u8], &'a provided::raw::Owner<'d, L>>
{
    type Output = provided::raw::Slice<&'a [u8], &'a provided::raw::Owner<'d, L>>;

    fn freeze(self) -> Self::Output {
        self.into()
    }
}

// SAFETY: conversion retains the bound and exact prefix borrow and owner unchanged.
unsafe impl<'a, 'd, L: provided::raw::Layout> buffer::raw::Freeze
    for bounded::Value<provided::raw::Slice<&'a mut [u8], &'a provided::raw::Owner<'d, L>>>
{
    type Output = bounded::Value<provided::raw::Slice<&'a [u8], &'a provided::raw::Owner<'d, L>>>;

    fn freeze(self) -> Self::Output {
        self.into()
    }
}

// SAFETY: the bound delegates mutable access to the unchanged provided slice.
unsafe impl<'a, O> buffer::raw::Mutable for bounded::Value<provided::raw::Slice<&'a mut [u8], O>>
where
    provided::raw::Slice<&'a mut [u8], O>: buffer::raw::Mutable,
    Self: buffer::raw::Source,
{
}

// SAFETY: the inner prefix performs the exact split; wrapping it preserves
// both disjoint ranges and their original owner and lifetimes.
unsafe impl<L: provided::raw::Layout> buffer::raw::Split
    for bounded::Value<provided::raw::Slice<&'_ mut [u8], &'_ provided::raw::Owner<'_, L>>>
{
}

// SAFETY: the original slice admits the exact disjoint prefix while retaining
// its owner and initialized suffix; the bound adds no extent or ownership change.
unsafe impl<L: provided::raw::Layout> buffer::raw::Split
    for bounded::Value<provided::raw::Slice<&'_ mut [u8], provided::raw::Owner<'_, L>>>
{
}

// SAFETY: conversion moves the same bounded extent and provided owner without
// allocating, copying bytes, cloning an edge or changing its return queue.
unsafe impl<'d, L: provided::raw::Layout> buffer::raw::Freeze
    for bounded::Value<provided::raw::Slice<&'d mut [u8], provided::raw::Owner<'d, L>>>
{
    type Output = bounded::Value<storage::Shared<provided::raw::Owner<'d, L>>>;

    fn freeze(self) -> Self::Output {
        self.into()
    }
}