Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- let f = Foo;
- f.func_self_used();
- println!("-------------------------");
- let f = Foo;
- f.func_call_without_self();
- }
- struct Foo;
- impl Drop for Foo {
- fn drop(&mut self) {
- println!("Dropped Foo");
- }
- }
- impl Foo {
- fn func_self_used(self) {
- println!("Before fn call");
- self.func_self_unused();
- println!("After fn call");
- }
- fn func_call_without_self(self) {
- println!("Before fn call, without self");
- Self::func_without_self();
- println!("After fn call, without self");
- }
- fn func_self_unused(self) {
- println!("Fn call with self");
- }
- fn func_without_self() {
- println!("Fn call with self");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement