-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
238 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "ouroboros_examples" | ||
version = "0.15.7" | ||
version = "0.17.0" | ||
authors = ["Joshua Maros <[email protected]>"] | ||
edition = "2018" | ||
license = "MIT OR Apache-2.0" | ||
|
@@ -21,7 +21,7 @@ std = [] | |
__tokio = ["tokio", "std"] | ||
|
||
[dependencies] | ||
ouroboros = { version = "0.15.7", path = "../ouroboros" } | ||
ouroboros = { version = "0.17.0", path = "../ouroboros" } | ||
tokio = { version = "1.27.0", features = [ "macros", "rt" ], optional = true } | ||
|
||
[dev-dependencies] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "ouroboros" | ||
version = "0.15.7" | ||
version = "0.17.0" | ||
authors = ["Joshua Maros <[email protected]>"] | ||
edition = "2018" | ||
license = "MIT OR Apache-2.0" | ||
|
@@ -11,7 +11,8 @@ repository = "https://github.com/joshua-maros/ouroboros" | |
|
||
[dependencies] | ||
aliasable = "0.1.3" | ||
ouroboros_macro = { version = "0.15.7", path = "../ouroboros_macro" } | ||
ouroboros_macro = { version = "0.17.0", path = "../ouroboros_macro" } | ||
static_assertions = "1.1.0" | ||
|
||
[features] | ||
default = ["std"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "ouroboros_macro" | ||
version = "0.15.7" | ||
version = "0.17.0" | ||
authors = ["Joshua Maros <[email protected]>"] | ||
edition = "2018" | ||
license = "MIT OR Apache-2.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use crate::info_structures::StructInfo; | ||
use proc_macro2::TokenStream; | ||
use quote::quote; | ||
use syn::Error; | ||
|
||
pub fn create_drop_impl(info: &StructInfo) -> Result<TokenStream, Error> { | ||
let ident = &info.ident; | ||
let internal_ident = &info.internal_ident; | ||
let generics = &info.generics; | ||
let generic_args = info.generic_arguments(); | ||
|
||
let mut where_clause = quote! {}; | ||
if let Some(clause) = &generics.where_clause { | ||
where_clause = quote! { #clause }; | ||
} | ||
Ok(quote! { | ||
impl #generics ::core::ops::Drop for #ident<#(#generic_args,)*> #where_clause { | ||
fn drop(&mut self) { | ||
unsafe { | ||
::core::ptr::drop_in_place(::core::mem::transmute::<_, *mut #internal_ident <#(#generic_args,)*>>(self)); | ||
} | ||
} | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
pub mod constructor; | ||
pub mod derives; | ||
pub mod drop; | ||
pub mod into_heads; | ||
pub mod struc; | ||
pub mod summon_checker; | ||
|
Oops, something went wrong.