Lines Matching refs:foo
102 let foo = pin_init!(Foo {
108 `foo` now is of the type [`impl PinInit<Foo>`]. We can now use any smart pointer that we like
112 let foo: Result<Pin<Box<Foo>>, AllocError> = Box::pin_init(foo);
171 pub struct foo {
175 pub fn init_foo(ptr: *mut foo);
176 pub fn destroy_foo(ptr: *mut foo);
178 pub fn enable_foo(ptr: *mut foo, flags: u32) -> i32;
184 /// `foo` is always initialized
190 foo: UnsafeCell<MaybeUninit<bindings::foo>>,
197 // enabled `foo`,
202 let foo = addr_of_mut!((*slot).foo);
203 let foo = UnsafeCell::raw_get(foo).cast::<bindings::foo>();
205 // Initialize the `foo`
206 bindings::init_foo(foo);
209 let err = bindings::enable_foo(foo, flags);
211 // Enabling has failed, first clean up the foo and then return the error.
212 bindings::destroy_foo(foo);
226 // SAFETY: Since `foo` is initialized, destroying is safe.
227 unsafe { bindings::destroy_foo(self.foo.get().cast::<bindings::foo>()) };