-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from dewert99/method-lifetime-params
Method lifetime params
- Loading branch information
Showing
2 changed files
with
29 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#![deny(late_bound_lifetime_arguments)] | ||
extern crate ambassador; | ||
|
||
use ambassador::{delegatable_trait, Delegate}; | ||
|
||
#[delegatable_trait] | ||
pub trait Shout { | ||
fn shout<'a>(&'a self) { | ||
println!("SHOUT!") | ||
} | ||
} | ||
|
||
pub struct A; | ||
impl Shout for A {} | ||
|
||
#[derive(Delegate)] | ||
#[delegate(Shout, target = "0")] | ||
pub struct B(A); | ||
|
||
fn main() { | ||
B(A).shout() | ||
} |