Skip to content

Instantly share code, notes, and snippets.

@stusmall
Last active July 11, 2016 03:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stusmall/afcf31b1cb9bf3c8989f6ba4c1a3c813 to your computer and use it in GitHub Desktop.
Save stusmall/afcf31b1cb9bf3c8989f6ba4c1a3c813 to your computer and use it in GitHub Desktop.
pub struct OutsideStruct<'a> {
data: InsideStruct<'a>
}
pub struct InsideStruct<'a> {
data: &'a[u8]
}
impl <'a>OutsideStruct<'a> {
pub fn new<'b>(data:&'b[u8]) -> OutsideStruct<'b>{
OutsideStruct{
data: InsideStruct::new(data)
}
}
}
impl <'a>InsideStruct<'a> {
pub fn new<'b>(data:&'b[u8]) -> InsideStruct{
InsideStruct{
data: data.clone()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment