Skip to content

Commit

Permalink
'Expand' refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem-Romanenia committed Jun 4, 2023
1 parent eb0c038 commit c002a70
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 157 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -740,10 +740,8 @@ struct CarDto {
``` rust
impl std::convert::Into<CarDto> for Car {
fn into(self) -> CarDto {
let mut obj = CarDto {
number_of_doors: self.number_of_doors,
..Default::default()
};
let mut obj: CarDto = Default::default();
obj.number_of_doors = self.number_of_doors;
self.vehicle.into_existing(&mut obj);
obj
}
Expand Down
6 changes: 4 additions & 2 deletions o2o-impl/src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,12 @@ impl Kind {
pub fn is_ref(self) -> bool {
self == Kind::FromRef || self == Kind::RefInto || self == Kind::RefIntoExisting
}

pub fn is_from(self) -> bool {
self == Kind::FromOwned || self == Kind::FromRef
}
pub fn is_into_existing(self) -> bool {
self == Kind::OwnedIntoExisting || self == Kind::RefIntoExisting
}
}

type ApplicableTo = [bool; 6];
Expand Down Expand Up @@ -285,7 +287,7 @@ impl<'a> FieldAttrs {
}
}

#[derive(Clone, Copy)]
#[derive(Clone, Copy, PartialEq)]
pub(crate) enum StructKindHint {
Struct = 0,
Tuple = 1,
Expand Down

0 comments on commit c002a70

Please sign in to comment.