Lines Matching full:foo
42 //! struct Foo {
48 //! let foo = pin_init!(Foo {
49 //! a <- new_mutex!(42, "Foo::a"),
54 //! `foo` now is of the type [`impl PinInit<Foo>`]. We can now use any smart pointer that we like
55 //! (or just the stack) to actually initialize a `Foo`:
62 //! # struct Foo {
67 //! # let foo = pin_init!(Foo {
68 //! # a <- new_mutex!(42, "Foo::a"),
71 //! let foo: Result<Pin<KBox<Foo>>> = KBox::pin_init(foo, GFP_KERNEL);
129 //! # pub struct foo;
130 //! # pub unsafe fn init_foo(_ptr: *mut foo) {}
131 //! # pub unsafe fn destroy_foo(_ptr: *mut foo) {}
132 //! # pub unsafe fn enable_foo(_ptr: *mut foo, _flags: u32) -> i32 { 0 }
144 //! /// `foo` is always initialized
148 //! foo: Opaque<bindings::foo>,
157 //! // enabled `foo`,
162 //! let foo = addr_of_mut!((*slot).foo);
164 //! // Initialize the `foo`
165 //! bindings::init_foo(Opaque::raw_get(foo));
168 //! let err = bindings::enable_foo(Opaque::raw_get(foo), flags);
170 //! // Enabling has failed, first clean up the foo and then return the error.
171 //! bindings::destroy_foo(Opaque::raw_get(foo));
185 //! // SAFETY: Since `foo` is initialized, destroying is safe.
186 //! unsafe { bindings::destroy_foo(self.foo.get()) };
205 //! [`impl PinInit<Foo>`]: PinInit
244 /// struct Foo {
255 /// stack_pin_init!(let foo = pin_init!(Foo {
261 /// let foo: Pin<&mut Foo> = foo;
262 /// pr_info!("a: {}\n", &*foo.a.lock());
305 /// struct Foo {
315 /// stack_try_pin_init!(let foo: Result<Pin<&mut Foo>, AllocError> = pin_init!(Foo {
321 /// let foo = foo.unwrap();
322 /// pr_info!("a: {}\n", &*foo.a.lock());
339 /// struct Foo {
349 /// stack_try_pin_init!(let foo: Pin<&mut Foo> =? pin_init!(Foo {
355 /// pr_info!("a: {}\n", &*foo.a.lock());
389 /// struct Foo {
399 /// # fn demo() -> impl PinInit<Foo> {
402 /// let initializer = pin_init!(Foo {
433 /// # struct Foo {
441 /// impl Foo {
453 /// Users of `Foo` can now create it like this:
460 /// # struct Foo {
468 /// # impl Foo {
478 /// let foo = KBox::pin_init(Foo::new(), GFP_KERNEL);
487 /// # struct Foo {
495 /// # impl Foo {
508 /// foo1: Foo,
510 /// foo2: Foo,
517 /// foo1 <- Foo::new(),
518 /// foo2 <- Foo::new(),
793 /// struct Foo<T> {
798 /// impl<T> Foo<T> {
800 /// assert_pinned!(Foo<T>, elem, T, inline);
878 /// struct Foo {
883 /// impl Foo {
885 /// pr_info!("Setting up foo\n");
889 /// let foo = pin_init!(Foo {
896 /// }).pin_chain(|foo| {
897 /// foo.setup();
983 /// struct Foo {
987 /// impl Foo {
989 /// pr_info!("Setting up foo\n");
993 /// let foo = init!(Foo {
995 /// }).chain(|foo| {
996 /// foo.setup();
1331 /// struct Foo {
1337 /// impl PinnedDrop for Foo {
1339 /// pr_info!("Foo is being dropped!\n");