#![doc=include_str!("../README.md")]
#[cfg(test)] #[path="../test/test.rs"] mod test;
#[allow(non_camel_case_types)]
pub trait PartialBorrow {
type All_Mut;
type All_Const;
type All_No;
type Fields;
const FIELDS: Self::Fields;
}
pub trait Downgrade<R> {
fn downgrade (input: &Self ) -> & R;
fn downgrade_mut(input: &mut Self) -> &mut R;
}
pub trait SplitOff<R> {
type Remaining;
fn split_off (input: & Self) -> (& R, & Self::Remaining);
fn split_off_mut(input: &mut Self) -> (&mut R, &mut Self::Remaining);
}
pub trait SplitInto<R,S> {
fn split_into (input: & Self) -> (& R, & S);
fn split_into_mut(input: &mut Self) -> (&mut R, &mut S);
}
pub use partial_borrow_macros::PartialBorrow;
pub use partial_borrow_macros::partial;
pub mod prelude {
pub use crate as partial_borrow;
pub use super::{PartialBorrow, partial};
}
pub mod perms {
#[derive(Debug)] pub struct Mut;
#[derive(Debug,Clone,Copy)] pub struct Const;
#[derive(Debug,Clone,Copy)] pub struct No;
pub unsafe trait IsRef { }
unsafe impl IsRef for Const { }
unsafe impl IsRef for Mut { }
pub unsafe trait IsMut: IsRef { }
unsafe impl IsMut for Mut { }
pub unsafe trait IsRefOrNot { const REF: Option<Const>; }
unsafe impl IsRefOrNot for Mut { const REF: Option<Const> = Some(Const); }
unsafe impl IsRefOrNot for Const { const REF: Option<Const> = Some(Const); }
unsafe impl IsRefOrNot for No { const REF: Option<Const> = None; }
pub unsafe trait IsDowngradeFrom<P> { type Remaining: IsRefOrNot; }
unsafe impl IsDowngradeFrom<Mut> for Mut { type Remaining = No; }
unsafe impl IsDowngradeFrom<Mut> for Const { type Remaining = Const; }
unsafe impl IsDowngradeFrom<Mut> for No { type Remaining = Mut; }
unsafe impl IsDowngradeFrom<Const> for Const { type Remaining = Const; }
unsafe impl IsDowngradeFrom<Const> for No { type Remaining = Const; }
unsafe impl IsDowngradeFrom<No> for No { type Remaining = No; }
pub unsafe trait CanSplitInto<R,S> { }
unsafe impl CanSplitInto<Mut ,No > for Mut { }
unsafe impl CanSplitInto<No ,No > for Mut { }
unsafe impl CanSplitInto<Const,Const> for Mut { }
unsafe impl CanSplitInto<Const,No > for Mut { }
unsafe impl CanSplitInto<No ,Mut > for Mut { }
unsafe impl CanSplitInto<No ,Const> for Mut { }
unsafe impl CanSplitInto<Const,Const> for Const { }
unsafe impl CanSplitInto<Const,No > for Const { }
unsafe impl CanSplitInto<No, Const> for Const { }
unsafe impl CanSplitInto<No, No > for Const { }
unsafe impl CanSplitInto<No,No> for No { }
pub trait Adjust<P, const FI: usize> { type Adjusted; }
}
pub mod imports {
pub use core::option::Option::Some;
pub use std::convert::{AsMut, AsRef};
pub use std::fmt::{self, Debug, Formatter};
pub use std::marker::{PhantomData, Sized};
pub use std::mem::transmute;
pub use std::ops::{Deref, DerefMut};
pub use memoffset::offset_of;
pub use super::*;
pub use perms::*;
pub use crate as partial_borrow;
}
pub use prelude::*;