Struct pipewire::Loop[][src]

pub struct Loop { /* fields omitted */ }

Implementations

Create a new loop from a raw pw_loop, taking ownership of it.

Safety

The provided pointer must point to a valid, well aligned pw_loop.

The raw loop should not be manually destroyed or moved, as the new Loop takes ownership of it.

Create a new Loop.

Consume the Loop and returns the underlying raw pw_loop.

After calling this function, the caller has ownership of the raw pw_loop, and should ensure it is properly destroyed when not used any longer.

Methods from Deref<Target = LoopRef>

Get the file descriptor backing this loop.

Enter a loop

Start an iteration of the loop. This function should be called before calling iterate and is typically used to capture the thread that this loop will run in.

Safety

Each call of enter must be paired with a call of leave.

Leave a loop

Ends the iteration of a loop. This should be called after calling iterate.

Safety

Each call of leave must be paired with a call of enter.

Perform one iteration of the loop.

An optional timeout can be provided. 0 for no timeout, -1 for infinite timeout.

This function will block up to the provided timeout and then dispatch the fds with activity. The number of dispatched fds is returned.

This will automatically call Self::enter() on the loop before iterating, and Self::leave() afterwards.

Panics

This function will panic if the provided timeout as milliseconds does not fit inside a c_int integer.

A variant of iterate() that does not call Self::enter() and Self::leave() on the loop.

Safety

Before calling this, Self::enter() must be called, and Self::leave() must be called afterwards.

Register some type of IO object with a callback that is called when reading/writing on the IO object is available.

The specified event_mask determines whether to trigger when either input, output, or any of the two is avaiable.

The returned IoSource needs to take ownership of the IO object, but will provide a reference to the callback when called.

Register a callback to be called whenever the loop is idle.

This can be enabled and disabled as needed with the enabled parameter, and also with the enable method on the returned source.

Register a signal with a callback that is called when the signal is sent.

For example, this can be used to quit the loop when the process receives the SIGTERM signal.

Register a new event with a callback that is called when the event happens.

The returned EventSource can be used to trigger the event.

Register a timer with the loop with a callback that is called after the timer expired.

The timer will start out inactive, and the returned TimerSource can be used to arm the timer, or disarm it again.

The callback will be provided with the number of timer expirations since the callback was last called.

Trait Implementations

Performs the conversion.

The resulting type after dereferencing.

Dereferences the value.

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.