summaryrefslogtreecommitdiff
path: root/libc/src/dox.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2018-12-10 21:00:27 -0800
committerDaniel Mueller <deso@posteo.net>2018-12-10 21:00:27 -0800
commite2604a756aaddcd5919ee2f1b9cc0055d200f846 (patch)
tree1ea1b9900db20d3aadbddbce18882d0c957247d7 /libc/src/dox.rs
parent5875df6c958743cf86c75b2cb5fc2efe5ca0de43 (diff)
downloadnitrocli-e2604a756aaddcd5919ee2f1b9cc0055d200f846.tar.gz
nitrocli-e2604a756aaddcd5919ee2f1b9cc0055d200f846.tar.bz2
Update libc crate to 0.2.45
This change updates the libc crate to version 0.2.45. Import subrepo libc/:libc at f5636fc618f8e16968b3178196d73c94ad9f7b05
Diffstat (limited to 'libc/src/dox.rs')
-rw-r--r--libc/src/dox.rs100
1 files changed, 84 insertions, 16 deletions
diff --git a/libc/src/dox.rs b/libc/src/dox.rs
index 5c095b9..33a9c16 100644
--- a/libc/src/dox.rs
+++ b/libc/src/dox.rs
@@ -1,14 +1,14 @@
pub use self::imp::*;
-#[cfg(not(dox))]
+#[cfg(not(cross_platform_docs))]
mod imp {
- pub use core::option::Option;
pub use core::clone::Clone;
pub use core::marker::Copy;
pub use core::mem;
+ pub use core::option::Option;
}
-#[cfg(dox)]
+#[cfg(cross_platform_docs)]
mod imp {
pub enum Option<T> {
Some(T),
@@ -16,7 +16,23 @@ mod imp {
}
impl<T: Copy> Copy for Option<T> {}
impl<T: Clone> Clone for Option<T> {
- fn clone(&self) -> Option<T> { loop {} }
+ fn clone(&self) -> Option<T> {
+ loop {}
+ }
+ }
+
+ impl<T> Copy for *mut T {}
+ impl<T> Clone for *mut T {
+ fn clone(&self) -> *mut T {
+ loop {}
+ }
+ }
+
+ impl<T> Copy for *const T {}
+ impl<T> Clone for *const T {
+ fn clone(&self) -> *const T {
+ loop {}
+ }
}
pub trait Clone {
@@ -37,56 +53,83 @@ mod imp {
pub trait Sized {}
macro_rules! each_int {
- ($mac:ident) => (
+ ($mac:ident) => {
$mac!(u8);
$mac!(u16);
$mac!(u32);
$mac!(u64);
$mac!(usize);
each_signed_int!($mac);
- )
+ };
}
macro_rules! each_signed_int {
- ($mac:ident) => (
+ ($mac:ident) => {
$mac!(i8);
$mac!(i16);
$mac!(i32);
$mac!(i64);
$mac!(isize);
- )
+ };
}
#[lang = "div"]
- pub trait Div<RHS> {
+ pub trait Div<RHS = Self> {
type Output;
fn div(self, rhs: RHS) -> Self::Output;
}
#[lang = "shl"]
- pub trait Shl<RHS> {
+ pub trait Shl<RHS = Self> {
type Output;
fn shl(self, rhs: RHS) -> Self::Output;
}
#[lang = "mul"]
- pub trait Mul<RHS=Self> {
+ pub trait Mul<RHS = Self> {
type Output;
fn mul(self, rhs: RHS) -> Self::Output;
}
#[lang = "sub"]
- pub trait Sub<RHS=Self> {
+ pub trait Sub<RHS = Self> {
type Output;
fn sub(self, rhs: RHS) -> Self::Output;
}
+ #[lang = "bitand"]
+ pub trait BitAnd<RHS = Self> {
+ type Output;
+ fn bitand(self, rhs: RHS) -> Self::Output;
+ }
+
+ #[lang = "bitand_assign"]
+ pub trait BitAndAssign<RHS = Self> {
+ fn bitand_assign(&mut self, rhs: RHS);
+ }
+
#[lang = "bitor"]
- pub trait Bitor<RHS=Self> {
+ pub trait BitOr<RHS = Self> {
type Output;
fn bitor(self, rhs: RHS) -> Self::Output;
}
+ #[lang = "bitor_assign"]
+ pub trait BitOrAssign<RHS = Self> {
+ fn bitor_assign(&mut self, rhs: RHS);
+ }
+
+ #[lang = "bitxor"]
+ pub trait BitXor<RHS = Self> {
+ type Output;
+ fn bitxor(self, rhs: RHS) -> Self::Output;
+ }
+
+ #[lang = "bitxor_assign"]
+ pub trait BitXorAssign<RHS = Self> {
+ fn bitxor_assign(&mut self, rhs: RHS);
+ }
+
#[lang = "neg"]
pub trait Neg {
type Output;
@@ -124,10 +167,27 @@ mod imp {
type Output = $i;
fn sub(self, rhs: $i) -> $i { self - rhs }
}
- impl Bitor for $i {
+ impl BitAnd for $i {
+ type Output = $i;
+ fn bitand(self, rhs: $i) -> $i { self & rhs }
+ }
+ impl BitAndAssign for $i {
+ fn bitand_assign(&mut self, rhs: $i) { *self &= rhs; }
+ }
+ impl BitOr for $i {
type Output = $i;
fn bitor(self, rhs: $i) -> $i { self | rhs }
}
+ impl BitOrAssign for $i {
+ fn bitor_assign(&mut self, rhs: $i) { *self |= rhs; }
+ }
+ impl BitXor for $i {
+ type Output = $i;
+ fn bitxor(self, rhs: $i) -> $i { self ^ rhs }
+ }
+ impl BitXorAssign for $i {
+ fn bitxor_assign(&mut self, rhs: $i) { *self ^= rhs; }
+ }
impl Neg for $i {
type Output = $i;
fn neg(self) -> $i { -self }
@@ -140,12 +200,20 @@ mod imp {
type Output = $i;
fn add(self, other: $i) -> $i { self + other }
}
+ impl Copy for $i {}
+ impl Clone for $i {
+ fn clone(&self) -> $i { loop {} }
+ }
)*)
}
each_int!(impl_traits);
pub mod mem {
- pub fn size_of_val<T>(_: &T) -> usize { 4 }
- pub fn size_of<T>(_: &T) -> usize { 4 }
+ pub fn size_of_val<T>(_: &T) -> usize {
+ 4
+ }
+ pub const fn size_of<T>() -> usize {
+ 4
+ }
}
}