Lines Matching full:foo

74 //! struct Foo {
80 //! let foo = pin_init!(Foo {
84 //! # let _ = Box::pin_init(foo);
87 //! `foo` now is of the type [`impl PinInit<Foo>`]. We can now use any smart pointer that we like
88 //! (or just the stack) to actually initialize a `Foo`:
98 //! # struct Foo {
104 //! # let foo = pin_init!(Foo {
108 //! let foo: Result<Pin<Box<Foo>>, AllocError> = Box::pin_init(foo);
177 //! pub struct foo {
181 //! pub fn init_foo(ptr: *mut foo);
182 //! pub fn destroy_foo(ptr: *mut foo);
184 //! pub fn enable_foo(ptr: *mut foo, flags: u32) -> i32;
190 //! /// `foo` is always initialized
196 //! foo: UnsafeCell<MaybeUninit<bindings::foo>>,
203 //! // enabled `foo`,
208 //! let foo = addr_of_mut!((*slot).foo);
209 //! let foo = UnsafeCell::raw_get(foo).cast::<bindings::foo>();
211 //! // Initialize the `foo`
212 //! bindings::init_foo(foo);
215 //! let err = bindings::enable_foo(foo, flags);
217 //! // Enabling has failed, first clean up the foo and then return the error.
218 //! bindings::destroy_foo(foo);
232 //! // SAFETY: Since `foo` is initialized, destroying is safe.
233 //! unsafe { bindings::destroy_foo(self.foo.get().cast::<bindings::foo>()) };
256 //! [`impl PinInit<Foo>`]: crate::PinInit
417 /// struct Foo {
428 /// stack_pin_init!(let foo = pin_init!(Foo {
434 /// let foo: Pin<&mut Foo> = foo;
435 /// println!("a: {}", &*foo.a.lock());
469 /// struct Foo {
479 /// stack_try_pin_init!(let foo: Foo = try_pin_init!(Foo {
485 /// let foo = foo.unwrap();
486 /// println!("a: {}", &*foo.a.lock());
496 /// struct Foo {
506 /// stack_try_pin_init!(let foo: Foo =? try_pin_init!(Foo {
512 /// println!("a: {}", &*foo.a.lock());
546 /// struct Foo {
556 /// # fn demo() -> impl PinInit<Foo> {
559 /// let initializer = pin_init!(Foo {
590 /// # struct Foo {
598 /// impl Foo {
610 /// Users of `Foo` can now create it like this:
617 /// # struct Foo {
625 /// # impl Foo {
635 /// let foo = Box::pin_init(Foo::new());
644 /// # struct Foo {
652 /// # impl Foo {
665 /// foo1: Foo,
667 /// foo2: Foo,
674 /// foo1 <- Foo::new(),
675 /// foo2 <- Foo::new(),
939 /// struct Foo<T> {
944 /// impl<T> Foo<T> {
946 /// assert_pinned!(Foo<T>, elem, T, inline);
1123 /// struct Foo {
1127 /// impl Foo {
1129 /// println!("Setting up foo");
1133 /// let foo = init!(Foo {
1135 /// }).chain(|foo| {
1136 /// foo.setup();
1352 /// struct Foo {
1358 /// impl PinnedDrop for Foo {
1360 /// println!("Foo is being dropped!");