Skip to content

Commit

Permalink
use spelled out Result in expanded code
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem-Romanenia committed Nov 18, 2024
1 parent 1b109eb commit 040b46f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "o2o"
version = "0.4.10"
version = "0.4.11"
edition = "2021"
authors = ["Artem Romanenia <artem.romanenia@gmail.com>"]
categories = ["rust-patterns"]
Expand All @@ -10,8 +10,8 @@ license = "MIT OR Apache-2.0"
repository = "https://github.com/Artem-Romanenia/o2o"

[dependencies]
o2o-impl = { version = "0.4.10", path = "o2o-impl", optional = true }
o2o-macros = { version = "0.4.10", path = "o2o-macros", optional = true }
o2o-impl = { version = "0.4.11", path = "o2o-impl", optional = true }
o2o-macros = { version = "0.4.11", path = "o2o-macros", optional = true }

[features]
default = ["macro"]
Expand Down
2 changes: 1 addition & 1 deletion o2o-impl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "o2o-impl"
version = "0.4.10"
version = "0.4.11"
edition = "2021"
authors = ["Artem Romanenia <artem.romanenia@gmail.com>"]
description = "Implementation of 'o2o' crate"
Expand Down
6 changes: 3 additions & 3 deletions o2o-impl/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ fn quote_try_from_trait(input: &DataType, ctx: &ImplContext, pre_init: Option<To
impl #impl_gens ::core::convert::TryFrom<#r #src #those_gens> for #dst #these_gens #where_clause {
type Error = #err_ty;
#attr
fn try_from(value: #r #src #those_gens) -> Result<#dst #these_gens, #err_ty> {
fn try_from(value: #r #src #those_gens) -> ::core::result::Result<#dst #these_gens, #err_ty> {
#inner_attr
#pre_init
#init
Expand Down Expand Up @@ -1190,7 +1190,7 @@ fn quote_try_into_trait(input: &DataType, ctx: &ImplContext, pre_init: Option<To
impl #impl_gens ::core::convert::TryInto<#dst #those_gens> for #r #src #these_gens #where_clause {
type Error = #err_ty;
#attr
fn try_into(self) -> Result<#dst #those_gens, #err_ty> {
fn try_into(self) -> ::core::result::Result<#dst #those_gens, #err_ty> {
#inner_attr
#body
}
Expand Down Expand Up @@ -1222,7 +1222,7 @@ fn quote_try_into_existing_trait(input: &DataType, ctx: &ImplContext, pre_init:
impl #impl_gens o2o::traits::TryIntoExisting<#dst #those_gens> for #r #src #these_gens #where_clause {
type Error = #err_ty;
#attr
fn try_into_existing(self, other: &mut #dst #those_gens) -> Result<(), #err_ty> {
fn try_into_existing(self, other: &mut #dst #those_gens) -> ::core::result::Result<(), #err_ty> {
#inner_attr
#pre_init
#init
Expand Down
24 changes: 12 additions & 12 deletions o2o-impl/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1804,7 +1804,7 @@ quote!{
impl ::core::convert::TryFrom<TestDto> for Test {
type Error = String;
#[attribute(param)]
fn try_from(value: TestDto) -> Result<Test, String> {
fn try_from(value: TestDto) -> ::core::result::Result<Test, String> {
#![inner_param(param)]
Ok(Test { x: value.x, })
}
Expand All @@ -1813,7 +1813,7 @@ quote!{
impl ::core::convert::TryFrom<&TestDto> for Test {
type Error = String;
#[attribute(param)]
fn try_from(value: &TestDto) -> Result<Test, String> {
fn try_from(value: &TestDto) -> ::core::result::Result<Test, String> {
#![inner_param(param)]
Ok(Test { x: value.x, })
}
Expand All @@ -1822,7 +1822,7 @@ quote!{
impl ::core::convert::TryInto<TestDto> for Test {
type Error = String;
#[attribute(param)]
fn try_into(self) -> Result<TestDto, String> {
fn try_into(self) -> ::core::result::Result<TestDto, String> {
#![inner_param(param)]
Ok(TestDto { x: self.x, })
}
Expand All @@ -1831,7 +1831,7 @@ quote!{
impl ::core::convert::TryInto<TestDto> for &Test {
type Error = String;
#[attribute(param)]
fn try_into(self) -> Result<TestDto, String> {
fn try_into(self) -> ::core::result::Result<TestDto, String> {
#![inner_param(param)]
Ok(TestDto { x: self.x, })
}
Expand All @@ -1840,7 +1840,7 @@ quote!{
impl o2o::traits::TryIntoExisting<TestDto> for Test {
type Error = String;
#[attribute(param)]
fn try_into_existing(self, other: &mut TestDto) -> Result<(), String> {
fn try_into_existing(self, other: &mut TestDto) -> ::core::result::Result<(), String> {
#![inner_param(param)]
other.x = self.x;
Ok(())
Expand All @@ -1850,7 +1850,7 @@ quote!{
impl o2o::traits::TryIntoExisting<TestDto> for &Test {
type Error = String;
#[attribute(param)]
fn try_into_existing(self, other: &mut TestDto) -> Result<(), String> {
fn try_into_existing(self, other: &mut TestDto) -> ::core::result::Result<(), String> {
#![inner_param(param)]
other.x = self.x;
Ok(())
Expand Down Expand Up @@ -2061,7 +2061,7 @@ quote!{
where 'c: 'a, 'd: 'b, 'a: 'c, 'b: 'd
{
type Error = String;
fn try_from(value: Entity<'c, 'd>) -> Result<EntityDto<'a, 'b>, String> {
fn try_from(value: Entity<'c, 'd>) -> ::core::result::Result<EntityDto<'a, 'b>, String> {
Ok(EntityDto {
some_int: value.some_int,
some_str: value.some_str,
Expand All @@ -2073,7 +2073,7 @@ quote!{
where 'c: 'a, 'd: 'b, 'a: 'c, 'b: 'd
{
type Error = String;
fn try_from(value: &'o2o Entity<'c, 'd>) -> Result<EntityDto<'a, 'b>, String> {
fn try_from(value: &'o2o Entity<'c, 'd>) -> ::core::result::Result<EntityDto<'a, 'b>, String> {
Ok(EntityDto {
some_int: value.some_int,
some_str: value.some_str,
Expand All @@ -2085,7 +2085,7 @@ quote!{
where 'c: 'a, 'd: 'b, 'a: 'c, 'b: 'd
{
type Error = String;
fn try_into(self) -> Result<Entity<'c, 'd>, String> {
fn try_into(self) -> ::core::result::Result<Entity<'c, 'd>, String> {
Ok(Entity {
some_int: self.some_int,
some_str: self.some_str,
Expand All @@ -2097,7 +2097,7 @@ quote!{
where 'c: 'a, 'd: 'b, 'a: 'c, 'b: 'd
{
type Error = String;
fn try_into(self) -> Result<Entity<'c, 'd>, String> {
fn try_into(self) -> ::core::result::Result<Entity<'c, 'd>, String> {
Ok(Entity {
some_int: self.some_int,
some_str: self.some_str,
Expand All @@ -2109,7 +2109,7 @@ quote!{
where 'c: 'a, 'd: 'b, 'a: 'c, 'b: 'd
{
type Error = String;
fn try_into_existing(self, other: &mut Entity<'c, 'd>) -> Result<(), String> {
fn try_into_existing(self, other: &mut Entity<'c, 'd>) -> ::core::result::Result<(), String> {
other.some_int = self.some_int;
other.some_str = self.some_str;
other.another_str = "123".into();
Expand All @@ -2120,7 +2120,7 @@ quote!{
where 'c: 'a, 'd: 'b, 'a: 'c, 'b: 'd
{
type Error = String;
fn try_into_existing(self, other: &mut Entity<'c, 'd>) -> Result<(), String> {
fn try_into_existing(self, other: &mut Entity<'c, 'd>) -> ::core::result::Result<(), String> {
other.some_int = self.some_int;
other.some_str = self.some_str;
other.another_str = "321".into();
Expand Down
4 changes: 2 additions & 2 deletions o2o-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "o2o-macros"
version = "0.4.10"
version = "0.4.11"
edition = "2021"
authors = ["Artem Romanenia <artem.romanenia@gmail.com>"]
description = "Macro definitions of 'o2o' crate"
Expand All @@ -11,5 +11,5 @@ repository = "https://github.com/Artem-Romanenia/o2o"
proc-macro = true

[dependencies]
o2o-impl = { version = "0.4.10", path = "../o2o-impl" }
o2o-impl = { version = "0.4.11", path = "../o2o-impl" }
syn = "1.0.3"
4 changes: 2 additions & 2 deletions o2o-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[package]
name = "o2o-tests"
version = "0.4.10"
version = "0.4.11"
edition = "2021"
authors = ["Artem Romanenia <artem.romanenia@gmail.com>"]
description = "Tests for 'o2o' crate"
license = "MIT OR Apache-2.0"
repository = "https://github.com/Artem-Romanenia/o2o"

[dependencies]
o2o = { version = "0.4.10", path = "../" }
o2o = { version = "0.4.11", path = "../" }
anyhow = "1.0.86"

[dev-dependencies]
Expand Down

0 comments on commit 040b46f

Please sign in to comment.