Lines Matching full:foo

80 //! struct Foo {
86 //! let foo = pin_init!(Foo {
90 //! # let _ = Box::pin_init(foo);
93 //! `foo` now is of the type [`impl PinInit<Foo>`]. We can now use any smart pointer that we like
94 //! (or just the stack) to actually initialize a `Foo`:
104 //! # struct Foo {
110 //! # let foo = pin_init!(Foo {
114 //! let foo: Result<Pin<Box<Foo>>, AllocError> = Box::pin_init(foo);
183 //! pub struct foo {
187 //! pub fn init_foo(ptr: *mut foo);
188 //! pub fn destroy_foo(ptr: *mut foo);
190 //! pub fn enable_foo(ptr: *mut foo, flags: u32) -> i32;
196 //! /// `foo` is always initialized
202 //! foo: UnsafeCell<MaybeUninit<bindings::foo>>,
209 //! // enabled `foo`,
214 //! let foo = addr_of_mut!((*slot).foo);
215 //! let foo = UnsafeCell::raw_get(foo).cast::<bindings::foo>();
217 //! // Initialize the `foo`
218 //! bindings::init_foo(foo);
221 //! let err = bindings::enable_foo(foo, flags);
223 //! // Enabling has failed, first clean up the foo and then return the error.
224 //! bindings::destroy_foo(foo);
238 //! // SAFETY: Since `foo` is initialized, destroying is safe.
239 //! unsafe { bindings::destroy_foo(self.foo.get().cast::<bindings::foo>()) };
262 //! [`impl PinInit<Foo>`]: crate::PinInit
472 /// struct Foo {
483 /// stack_pin_init!(let foo = pin_init!(Foo {
489 /// let foo: Pin<&mut Foo> = foo;
490 /// println!("a: {}", &*foo.a.lock());
524 /// struct Foo {
534 /// stack_try_pin_init!(let foo: Foo = pin_init!(Foo {
540 /// let foo = foo.unwrap();
541 /// println!("a: {}", &*foo.a.lock());
551 /// struct Foo {
561 /// stack_try_pin_init!(let foo: Foo =? pin_init!(Foo {
567 /// println!("a: {}", &*foo.a.lock());
601 /// struct Foo {
611 /// # fn demo() -> impl PinInit<Foo> {
614 /// let initializer = pin_init!(Foo {
645 /// # struct Foo {
653 /// impl Foo {
665 /// Users of `Foo` can now create it like this:
672 /// # struct Foo {
680 /// # impl Foo {
690 /// let foo = Box::pin_init(Foo::new());
699 /// # struct Foo {
707 /// # impl Foo {
720 /// foo1: Foo,
722 /// foo2: Foo,
729 /// foo1 <- Foo::new(),
730 /// foo2 <- Foo::new(),
860 /// struct Foo<T> {
865 /// impl<T> Foo<T> {
867 /// assert_pinned!(Foo<T>, elem, T, inline);
1044 /// struct Foo {
1048 /// impl Foo {
1050 /// println!("Setting up foo");
1054 /// let foo = init!(Foo {
1056 /// }).chain(|foo| {
1057 /// foo.setup();
1273 /// # struct Foo { a: u64, b: isize }
1277 /// fn init_foo() -> impl PinInit<Foo, Error> {
1280 /// Ok(pin_init!(Foo { a: bar.a.into(), b: bar.b }? Error))
1316 /// # struct Foo { a: u64, b: isize }
1320 /// fn init_foo() -> impl Init<Foo, Error> {
1323 /// Ok(init!(Foo { a: bar.a.into(), b: bar.b }? Error))
1443 /// struct Foo {
1449 /// impl PinnedDrop for Foo {
1451 /// println!("Foo is being dropped!");
1676 /// struct Foo {}
1681 /// content: UnsafeCell<Foo>
1684 /// let foo_initializer = pin_init!(Foo{});