Struct futures_glib::Source [] [src]

pub struct Source<T> { /* fields omitted */ }

A binding to the GSource underlying type.

Methods

impl<T: SourceFuncs> Source<T>
[src]

Creates a new GSource structure.

The source will not initially be associated with any MainContext and must be added to one with attach before it will be executed.

Acquires an underlying reference to the data contained within this Source.

Adds a Source to a context so that it will be executed within that context.

Removes a source from its MainContext, if any, and mark it as destroyed.

The source cannot be subsequently added to another context. It is safe to call this on sources which have already been removed from their context.

Sets the priority of a source.

While the main loop is being run, a source will be dispatched if it is ready to be dispatched and no sources at a higher (numerically smaller) priority are ready to be dispatched.

A child source always has the same priority as its parent. It is not permitted to change the priority of a source once it has been added as a child of another source.

Gets the priority of a source.

Sets whether a source can be called recursively.

If can_recurse is true, then while the source is being dispatched then this source will be processed normally. Otherwise, all processing of this source is blocked until the dispatch function returns.

Checks whether a source is allowed to be called recursively.

Returns the numeric ID for a particular source.

The ID of a source is a positive integer which is unique within a particular main loop context.

Gets the MainContext with which the source is associated.

Sets the callback function for a source. The callback for a source is called from the source's dispatch function.

Sets a Source to be dispatched when the given monotonic time is reached (or passed). If the monotonic time is in the past (as it always will be if ready_time is the current time) then the source will be dispatched immediately.

If ready_time is None then the source is never woken up on the basis of the passage of time.

Dispatching the source does not reset the ready time. You should do so yourself, from the source dispatch function.

Note that if you have a pair of sources where the ready time of one suggests that it will be delivered first but the priority for the other suggests that it would be delivered first, and the ready time for both sources is reached during the same main context iteration then the order of dispatch is undefined.

This API is only intended to be used by implementations of Source. Do not call this API on a Source that you did not create.

Monitors fd for the IO events in events.

The token returned by this function can be used to remove or modify the monitoring of the fd using unix_remove_fd or unix_modify_fd.

It is not necessary to remove the fd before destroying the source; it will be cleaned up automatically.

This API is only intended to be used by implementations of Source. Do not call this API on a Source that you did not create.

As the name suggests, this function is not available on Windows.

Updates the event mask to watch for the fd identified by tag .

token is the token returned from unix_add_fd

If you want to remove a fd, don't set its event mask to zero. Instead, call remove_unix_fd

This API is only intended to be used by implementations of Source. Do not call this API on a Source that you did not create.

As the name suggests, this function is not available on Windows.

Unsafety

This function can only be called with tokens that were returned from this source's unix_add_fd implementation and haven't been removed yet.

Reverses the effect of a previous call to unix_add_fd.

You only need to call this if you want to remove an fd from being watched while keeping the same source around. In the normal case you will just want to destroy the source.

This API is only intended to be used by implementations of Source. Do not call this API on a Source that you did not create.

As the name suggests, this function is not available on Windows.

Unsafety

This function can only be called with tokens that were returned from this source's unix_add_fd implementation and haven't been removed yet.

Queries the events reported for the fd corresponding to token on source during the last poll.

The return value of this function is only defined when the function is called from the check or dispatch functions for source.

This API is only intended to be used by implementations of Source. Do not call this API on a Source that you did not create.

As the name suggests, this function is not available on Windows.

Unsafety

This function can only be called with tokens that were returned from this source's unix_add_fd implementation and haven't been removed yet.

Trait Implementations

impl<T> Clone for Source<T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T> Drop for Source<T>
[src]

A method called when the value goes out of scope. Read more