Skip to content

Commit

Permalink
Recheck hygiene and update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tyranron committed Mar 27, 2024
1 parent ca96f49 commit 5186720
Show file tree
Hide file tree
Showing 28 changed files with 161 additions and 128 deletions.
6 changes: 3 additions & 3 deletions impl/doc/add.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Code like this will be generated:

```rust
# struct MyInts(i32, i32);
impl ::core::ops::Add for MyInts {
impl derive_more::Add for MyInts {
type Output = MyInts;
fn add(self, rhs: MyInts) -> MyInts {
MyInts(self.0.add(rhs.0), self.1.add(rhs.1))
Expand Down Expand Up @@ -60,7 +60,7 @@ Code like this will be generated:
# x: i32,
# y: i32,
# }
impl ::core::ops::Add for Point2D {
impl derive_more::Add for Point2D {
type Output = Point2D;
fn add(self, rhs: Point2D) -> Point2D {
Point2D {
Expand Down Expand Up @@ -112,7 +112,7 @@ Code like this will be generated:
# UnsignedTwo(u32),
# Unit,
# }
impl derive_more::core::ops::Add for MixedInts {
impl derive_more::Add for MixedInts {
type Output = Result<MixedInts, derive_more::BinaryError>;
fn add(self, rhs: MixedInts) -> Result<MixedInts, derive_more::BinaryError> {
match (self, rhs) {
Expand Down
4 changes: 2 additions & 2 deletions impl/doc/add_assign.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Code like this will be generated:

```rust
# struct MyInts(i32, i32);
impl ::core::ops::AddAssign for MyInts {
impl derive_more::AddAssign for MyInts {
fn add_assign(&mut self, rhs: MyInts) {
self.0.add_assign(rhs.0);
self.1.add_assign(rhs.1);
Expand Down Expand Up @@ -56,7 +56,7 @@ Code like this will be generated:
# x: i32,
# y: i32,
# }
impl ::core::ops::AddAssign for Point2D {
impl derive_more::AddAssign for Point2D {
fn add_assign(&mut self, rhs: Point2D) {
self.x.add_assign(rhs.x);
self.y.add_assign(rhs.y);
Expand Down
6 changes: 3 additions & 3 deletions impl/doc/as_mut.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Generates:

```rust
# struct MyWrapper(String);
impl AsMut<String> for MyWrapper {
impl derive_more::AsMut<String> for MyWrapper {
fn as_mut(&mut self) -> &mut String {
&mut self.0
}
Expand All @@ -50,9 +50,9 @@ This generates code equivalent to:

```rust
# struct SingleFieldForward(Vec<i32>);
impl<T: ?Sized> AsMut<T> for SingleFieldForward
impl<T: ?Sized> derive_more::AsMut<T> for SingleFieldForward
where
Vec<i32>: AsMut<T>,
Vec<i32>: derive_more::AsMut<T>,
{
#[inline]
fn as_mut(&mut self) -> &mut T {
Expand Down
6 changes: 3 additions & 3 deletions impl/doc/as_ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Generates:

```rust
# struct MyWrapper(String);
impl AsRef<String> for MyWrapper {
impl derive_more::AsRef<String> for MyWrapper {
fn as_ref(&self) -> &String {
&self.0
}
Expand All @@ -50,9 +50,9 @@ This generates code equivalent to:

```rust
# struct SingleFieldForward(Vec<i32>);
impl<T: ?Sized> AsRef<T> for SingleFieldForward
impl<T: ?Sized> derive_more::AsRef<T> for SingleFieldForward
where
Vec<i32>: AsRef<T>,
Vec<i32>: derive_more::AsRef<T>,
{
#[inline]
fn as_ref(&self) -> &T {
Expand Down
8 changes: 4 additions & 4 deletions impl/doc/deref.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Code like this will be generated:
# cool: bool,
# vec: Vec<i32>,
# }
impl ::core::ops::Deref for CoolVec {
impl derive_more::Deref for CoolVec {
type Target = Vec<i32>;
#[inline]
fn deref(&self) -> &Self::Target {
Expand All @@ -90,11 +90,11 @@ Code like this will be generated:

```rust
# struct MyBoxedInt(Box<i32>);
impl ::core::ops::Deref for MyBoxedInt {
type Target = <Box<i32> as ::core::ops::Deref>::Target;
impl derive_more::Deref for MyBoxedInt {
type Target = <Box<i32> as derive_more::Deref>::Target;
#[inline]
fn deref(&self) -> &Self::Target {
<Box<i32> as ::core::ops::Deref>::deref(&self.0)
<Box<i32> as derive_more::Deref>::deref(&self.0)
}
}
```
Expand Down
16 changes: 9 additions & 7 deletions impl/doc/deref_mut.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,19 @@ struct CoolVec {
Code like this will be generated:

```rust
# use ::core::ops::Deref;
# struct CoolVec {
# cool: bool,
# vec: Vec<i32>,
# }
# impl ::core::ops::Deref for CoolVec {
# impl Deref for CoolVec {
# type Target = Vec<i32>;
# #[inline]
# fn deref(&self) -> &Self::Target {
# &self.vec
# }
# }
impl ::core::ops::DerefMut for CoolVec {
impl derive_more::DerefMut for CoolVec {
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.vec
Expand All @@ -106,18 +107,19 @@ struct MyBoxedInt(Box<i32>);
When deriving a forwarded `DerefMut` for a struct:

```rust
# use ::core::ops::Deref;
# struct MyBoxedInt(Box<i32>);
# impl ::core::ops::Deref for MyBoxedInt {
# type Target = <Box<i32> as ::core::ops::Deref>::Target;
# impl Deref for MyBoxedInt {
# type Target = <Box<i32> as Deref>::Target;
# #[inline]
# fn deref(&self) -> &Self::Target {
# <Box<i32> as ::core::ops::Deref>::deref(&self.0)
# <Box<i32> as Deref>::deref(&self.0)
# }
# }
impl ::core::ops::DerefMut for MyBoxedInt {
impl derive_more::DerefMut for MyBoxedInt {
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
<Box<i32> as ::core::ops::DerefMut>::deref_mut(&mut self.0)
<Box<i32> as derive_more::DerefMut>::deref_mut(&mut self.0)
}
}
```
Expand Down
10 changes: 5 additions & 5 deletions impl/doc/from_str.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ Code like this will be generated:

```rust
# struct MyInt(i32);
impl ::core::str::FromStr for MyInt {
type Err = <i32 as ::core::str::FromStr>::Err;
impl derive_more::FromStr for MyInt {
type Err = <i32 as derive_more::FromStr>::Err;
fn from_str(src: &str) -> Result<Self, Self::Err> {
return Ok(MyInt(i32::from_str(src)?));
}
Expand Down Expand Up @@ -74,8 +74,8 @@ Code like this will be generated:
# struct Point1D {
# x: i32,
# }
impl ::core::str::FromStr for Point1D {
type Err = <i32 as ::core::str::FromStr>::Err;
impl derive_more::FromStr for Point1D {
type Err = <i32 as derive_more::FromStr>::Err;
fn from_str(src: &str) -> Result<Self, Self::Err> {
return Ok(Point1D {
x: i32::from_str(src)?,
Expand Down Expand Up @@ -121,7 +121,7 @@ Code like this will be generated:
# Baz,
# }
#
impl ::core::str::FromStr for EnumNoFields {
impl derive_more::FromStr for EnumNoFields {
type Err = derive_more::FromStrError;
fn from_str(src: &str) -> Result<Self, Self::Err> {
Ok(match src.to_lowercase().as_str() {
Expand Down
8 changes: 4 additions & 4 deletions impl/doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ Code like this will be generated:
# numbers: Vec<i32>,
# useless: bool,
# }
impl<__IdxT> ::core::ops::Index<__IdxT> for Numbers
impl<__IdxT> derive_more::Index<__IdxT> for Numbers
where
Vec<i32>: ::core::ops::Index<__IdxT>,
Vec<i32>: derive_more::Index<__IdxT>,
{
type Output = <Vec<i32> as ::core::ops::Index<__IdxT>>::Output;
type Output = <Vec<i32> as derive_more::Index<__IdxT>>::Output;
#[inline]
fn index(&self, idx: __IdxT) -> &Self::Output {
<Vec<i32> as ::core::ops::Index<__IdxT>>::index(&self.numbers, idx)
<Vec<i32> as derive_more::Index<__IdxT>>::index(&self.numbers, idx)
}
}
```
Expand Down
15 changes: 8 additions & 7 deletions impl/doc/index_mut.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,28 @@ struct Numbers {
Code like this will be generated to implement `IndexMut`:

```rust
# use ::core::ops::Index;
# struct Numbers {
# numbers: Vec<i32>,
# useless: bool,
# }
# impl<__IdxT> ::core::ops::Index<__IdxT> for Numbers
# impl<__IdxT> Index<__IdxT> for Numbers
# where
# Vec<i32>: ::core::ops::Index<__IdxT>,
# Vec<i32>: Index<__IdxT>,
# {
# type Output = <Vec<i32> as ::core::ops::Index<__IdxT>>::Output;
# type Output = <Vec<i32> as Index<__IdxT>>::Output;
# #[inline]
# fn index(&self, idx: __IdxT) -> &Self::Output {
# <Vec<i32> as ::core::ops::Index<__IdxT>>::index(&self.numbers, idx)
# <Vec<i32> as Index<__IdxT>>::index(&self.numbers, idx)
# }
# }
impl<__IdxT> ::core::ops::IndexMut<__IdxT> for Numbers
impl<__IdxT> derive_more::IndexMut<__IdxT> for Numbers
where
Vec<i32>: ::core::ops::IndexMut<__IdxT>,
Vec<i32>: derive_more::IndexMut<__IdxT>,
{
#[inline]
fn index_mut(&mut self, idx: __IdxT) -> &mut Self::Output {
<Vec<i32> as ::core::ops::IndexMut<__IdxT>>::index_mut(&mut self.numbers, idx)
<Vec<i32> as derive_more::IndexMut<__IdxT>>::index_mut(&mut self.numbers, idx)
}
}
```
Expand Down
24 changes: 12 additions & 12 deletions impl/doc/into_iterator.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,30 +63,30 @@ Code like this will be generated:
# numbers: Vec<i32>,
# useless: bool,
# }
impl ::core::iter::IntoIterator for Numbers {
type Item = <Vec<i32> as ::core::iter::IntoIterator>::Item;
type IntoIter = <Vec<i32> as ::core::iter::IntoIterator>::IntoIter;
impl derive_more::IntoIterator for Numbers {
type Item = <Vec<i32> as derive_more::IntoIterator>::Item;
type IntoIter = <Vec<i32> as derive_more::IntoIterator>::IntoIter;
#[inline]
fn into_iter(self) -> Self::IntoIter {
<Vec<i32> as ::core::iter::IntoIterator>::into_iter(self.numbers)
<Vec<i32> as derive_more::IntoIterator>::into_iter(self.numbers)
}
}

impl<'__deriveMoreLifetime> ::core::iter::IntoIterator for &'__deriveMoreLifetime Numbers {
type Item = <&'__deriveMoreLifetime Vec<i32> as ::core::iter::IntoIterator>::Item;
type IntoIter = <&'__deriveMoreLifetime Vec<i32> as ::core::iter::IntoIterator>::IntoIter;
impl<'__deriveMoreLifetime> derive_more::IntoIterator for &'__deriveMoreLifetime Numbers {
type Item = <&'__deriveMoreLifetime Vec<i32> as derive_more::IntoIterator>::Item;
type IntoIter = <&'__deriveMoreLifetime Vec<i32> as derive_more::IntoIterator>::IntoIter;
#[inline]
fn into_iter(self) -> Self::IntoIter {
<&'__deriveMoreLifetime Vec<i32> as ::core::iter::IntoIterator>::into_iter(&self.numbers)
<&'__deriveMoreLifetime Vec<i32> as derive_more::IntoIterator>::into_iter(&self.numbers)
}
}

impl<'__deriveMoreLifetime> ::core::iter::IntoIterator for &'__deriveMoreLifetime mut Numbers {
type Item = <&'__deriveMoreLifetime mut Vec<i32> as ::core::iter::IntoIterator>::Item;
type IntoIter = <&'__deriveMoreLifetime mut Vec<i32> as ::core::iter::IntoIterator>::IntoIter;
impl<'__deriveMoreLifetime> derive_more::IntoIterator for &'__deriveMoreLifetime mut Numbers {
type Item = <&'__deriveMoreLifetime mut Vec<i32> as derive_more::IntoIterator>::Item;
type IntoIter = <&'__deriveMoreLifetime mut Vec<i32> as derive_more::IntoIterator>::IntoIter;
#[inline]
fn into_iter(self) -> Self::IntoIter {
<&'__deriveMoreLifetime mut Vec<i32> as ::core::iter::IntoIterator>::into_iter(
<&'__deriveMoreLifetime mut Vec<i32> as derive_more::IntoIterator>::into_iter(
&mut self.numbers,
)
}
Expand Down
16 changes: 8 additions & 8 deletions impl/doc/mul.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Code like this will be generated:

```rust
# struct MyInt(i32);
impl<__RhsT> ::core::ops::Mul<__RhsT> for MyInt
where i32: ::core::ops::Mul<__RhsT, Output = i32>
impl<__RhsT> derive_more::Mul<__RhsT> for MyInt
where i32: derive_more::Mul<__RhsT, Output = i32>
{
type Output = MyInt;
fn mul(self, rhs: __RhsT) -> MyInt {
Expand All @@ -60,8 +60,8 @@ Code like this will be generated:

```rust
# struct MyInts(i32, i32);
impl<__RhsT: ::core::marker::Copy> ::core::ops::Mul<__RhsT> for MyInts
where i32: ::core::ops::Mul<__RhsT, Output = i32>
impl<__RhsT: Copy> derive_more::Mul<__RhsT> for MyInts
where i32: derive_more::Mul<__RhsT, Output = i32>
{
type Output = MyInts;
fn mul(self, rhs: __RhsT) -> MyInts {
Expand Down Expand Up @@ -94,8 +94,8 @@ Code like this will be generated:
# struct Point1D {
# x: i32,
# }
impl<__RhsT> ::core::ops::Mul<__RhsT> for Point1D
where i32: ::core::ops::Mul<__RhsT, Output = i32>
impl<__RhsT> derive_more::Mul<__RhsT> for Point1D
where i32: derive_more::Mul<__RhsT, Output = i32>
{
type Output = Point1D;
fn mul(self, rhs: __RhsT) -> Point1D {
Expand Down Expand Up @@ -125,8 +125,8 @@ Code like this will be generated:
# x: i32,
# y: i32,
# }
impl<__RhsT: ::core::marker::Copy> ::core::ops::Mul<__RhsT> for Point2D
where i32: ::core::ops::Mul<__RhsT, Output = i32>
impl<__RhsT: Copy> derive_more::Mul<__RhsT> for Point2D
where i32: derive_more::Mul<__RhsT, Output = i32>
{
type Output = Point2D;
fn mul(self, rhs: __RhsT) -> Point2D {
Expand Down
8 changes: 4 additions & 4 deletions impl/doc/mul_assign.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Code like this will be generated:

```rust
# struct MyInts(i32, i32);
impl<__RhsT: ::core::marker::Copy> ::core::ops::MulAssign<__RhsT> for MyInts
where i32: ::core::ops::MulAssign<__RhsT>
impl<__RhsT: Copy> derive_more::MulAssign<__RhsT> for MyInts
where i32: derive_more::MulAssign<__RhsT>
{
fn mul_assign(&mut self, rhs: __RhsT) {
self.0.mul_assign(rhs);
Expand Down Expand Up @@ -64,8 +64,8 @@ Code like this will be generated:
# x: i32,
# y: i32,
# }
impl<__RhsT: ::core::marker::Copy> ::core::ops::MulAssign<__RhsT> for Point2D
where i32: ::core::ops::MulAssign<__RhsT>
impl<__RhsT: Copy> derive_more::MulAssign<__RhsT> for Point2D
where i32: derive_more::MulAssign<__RhsT>
{
fn mul_assign(&mut self, rhs: __RhsT) {
self.x.mul_assign(rhs);
Expand Down
8 changes: 4 additions & 4 deletions impl/doc/not.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Code like this will be generated:

```rust
# struct MyInts(i32, i32);
impl derive_more::core::ops::Not for MyInts {
impl derive_more::Not for MyInts {
type Output = MyInts;
fn not(self) -> MyInts {
MyInts(self.0.not(), self.1.not())
Expand Down Expand Up @@ -57,7 +57,7 @@ Code like this will be generated:
# x: i32,
# y: i32,
# }
impl derive_more::core::ops::Not for Point2D {
impl derive_more::Not for Point2D {
type Output = Point2D;
fn not(self) -> Point2D {
Point2D {
Expand Down Expand Up @@ -104,7 +104,7 @@ Code like this will be generated:
# UnsignedOne(u32),
# UnsignedTwo(u32),
# }
impl derive_more::core::ops::Not for MixedInts {
impl derive_more::Not for MixedInts {
type Output = MixedInts;
fn not(self) -> MixedInts {
match self {
Expand Down Expand Up @@ -147,7 +147,7 @@ Code like this will be generated:
# SmallInt(i32),
# Unit,
# }
impl derive_more::core::ops::Not for EnumWithUnit {
impl derive_more::Not for EnumWithUnit {
type Output = Result<EnumWithUnit, derive_more::UnitError>;
fn not(self) -> Result<EnumWithUnit, derive_more::UnitError> {
match self {
Expand Down
Loading

0 comments on commit 5186720

Please sign in to comment.