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<Box<Foo>>> = Box::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
245 /// struct Foo {
256 /// stack_pin_init!(let foo = pin_init!(Foo {
262 /// let foo: Pin<&mut Foo> = foo;
263 /// pr_info!("a: {}", &*foo.a.lock());
298 /// struct Foo {
308 /// stack_try_pin_init!(let foo: Result<Pin<&mut Foo>, AllocError> = pin_init!(Foo {
314 /// let foo = foo.unwrap();
315 /// pr_info!("a: {}", &*foo.a.lock());
324 /// struct Foo {
334 /// stack_try_pin_init!(let foo: Pin<&mut Foo> =? pin_init!(Foo {
340 /// pr_info!("a: {}", &*foo.a.lock());
375 /// struct Foo {
385 /// # fn demo() -> impl PinInit<Foo> {
388 /// let initializer = pin_init!(Foo {
420 /// # struct Foo {
428 /// impl Foo {
440 /// Users of `Foo` can now create it like this:
447 /// # struct Foo {
455 /// # impl Foo {
465 /// let foo = Box::pin_init(Foo::new(), GFP_KERNEL);
475 /// # struct Foo {
483 /// # impl Foo {
496 /// foo1: Foo,
498 /// foo2: Foo,
505 /// foo1 <- Foo::new(),
506 /// foo2 <- Foo::new(),
781 /// struct Foo<T> {
786 /// impl<T> Foo<T> {
788 /// assert_pinned!(Foo<T>, elem, T, inline);
866 /// struct Foo {
871 /// impl Foo {
873 /// pr_info!("Setting up foo");
877 /// let foo = pin_init!(Foo {
883 /// }).pin_chain(|foo| {
884 /// foo.setup();
970 /// struct Foo {
974 /// impl Foo {
976 /// pr_info!("Setting up foo");
980 /// let foo = init!(Foo {
982 /// }).chain(|foo| {
983 /// foo.setup();
1355 /// struct Foo {
1361 /// impl PinnedDrop for Foo {
1363 /// pr_info!("Foo is being dropped!");