about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorStephane Raux <stephaneyfx@gmail.com>2019-10-30 09:43:04 -0700
committerStephane Raux <stephaneyfx@gmail.com>2019-11-01 04:34:12 -0700
commit812ec6a3bf775c1564ed3b12374c4ee81bfa94b8 (patch)
tree061eacd87cc454faad75fcd7f9dd13fcdc64fa35 /src/liballoc
parentaea94230c476fea2ee073a1bc672125e4586d4b5 (diff)
downloadrust-812ec6a3bf775c1564ed3b12374c4ee81bfa94b8.tar.gz
rust-812ec6a3bf775c1564ed3b12374c4ee81bfa94b8.zip
Update FFI example
- Use meaningful names
- Clarify comments
- Fix C function declaration
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/boxed.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs
index b2b23cc9671..a502a5b0a0b 100644
--- a/src/liballoc/boxed.rs
+++ b/src/liballoc/boxed.rs
@@ -68,8 +68,8 @@
 //!
 //! ```c
 //! /* C header */
-//! struct Foo* foo(); /* Returns ownership */
-//! void bar(struct Foo*); /* `bar` takes ownership */
+//! struct Foo* foo_new(void); /* Returns ownership to the caller */
+//! void foo_delete(struct Foo*); /* Takes ownership from the caller */
 //! ```
 //!
 //! ```
@@ -77,12 +77,12 @@
 //! pub struct Foo;
 //!
 //! #[no_mangle]
-//! pub extern "C" fn foo() -> Box<Foo> {
+//! pub extern "C" fn foo_new() -> Box<Foo> {
 //!     Box::new(Foo)
 //! }
 //!
 //! #[no_mangle]
-//! pub extern "C" fn bar(_: Option<Box<Foo>>) {}
+//! pub extern "C" fn foo_delete(_: Option<Box<Foo>>) {}
 //! ```
 //!
 //! [dereferencing]: ../../std/ops/trait.Deref.html