Struct xpcom::interfaces::nsIPipe
[−]
[src]
#[repr(C)]pub struct nsIPipe { /* fields omitted */ }
interface nsIPipe : nsISupports
/**
* nsIPipe represents an in-process buffer that can be read using nsIInputStream
* and written using nsIOutputStream. The reader and writer of a pipe do not
* have to be on the same thread. As a result, the pipe is an ideal mechanism
* to bridge data exchange between two threads. For example, a worker thread
* might write data to a pipe from which the main thread will read.
*
* Each end of the pipe can be either blocking or non-blocking. Recall that a
* non-blocking stream will return NS_BASE_STREAM_WOULD_BLOCK if it cannot be
* read or written to without blocking the calling thread. For example, if you
* try to read from an empty pipe that has not yet been closed, then if that
* pipe's input end is non-blocking, then the read call will fail immediately
* with NS_BASE_STREAM_WOULD_BLOCK as the error condition. However, if that
* pipe's input end is blocking, then the read call will not return until the
* pipe has data or until the pipe is closed. This example presumes that the
* pipe is being filled asynchronously on some background thread.
*
* The pipe supports nsIAsyncInputStream and nsIAsyncOutputStream, which give
* the user of a non-blocking pipe the ability to wait for the pipe to become
* ready again. For example, in the case of an empty non-blocking pipe, the
* user can call AsyncWait on the input end of the pipe to be notified when
* the pipe has data to read (or when the pipe becomes closed).
*
* NS_NewPipe2 and NS_NewPipe provide convenient pipe constructors. In most
* cases nsIPipe is not actually used. It is usually enough to just get
* references to the pipe's input and output end. In which case, the pipe is
* automatically closed when the respective pipe ends are released.
*/
Methods
impl nsIPipe
[src]
impl nsIPipe
[src]
pub unsafe fn Init(
&self,
nonBlockingInput: bool,
nonBlockingOutput: bool,
segmentSize: uint32_t,
segmentCount: uint32_t
) -> nsresult
[src]
&self,
nonBlockingInput: bool,
nonBlockingOutput: bool,
segmentSize: uint32_t,
segmentCount: uint32_t
) -> nsresult
/**
* initialize this pipe
*
* @param nonBlockingInput
* true specifies non-blocking input stream behavior
* @param nonBlockingOutput
* true specifies non-blocking output stream behavior
* @param segmentSize
* specifies the segment size in bytes (pass 0 to use default value)
* @param segmentCount
* specifies the max number of segments (pass 0 to use default
* value). Passing UINT32_MAX here causes the pipe to have
* "infinite" space. This mode can be useful in some cases, but
* should always be used with caution. The default value for this
* parameter is a finite value.
*/
[must_use] void init (in boolean nonBlockingInput, in boolean nonBlockingOutput, in unsigned long segmentSize, in unsigned long segmentCount);
pub unsafe fn GetInputStream(
&self,
aInputStream: *mut *const nsIAsyncInputStream
) -> nsresult
[src]
&self,
aInputStream: *mut *const nsIAsyncInputStream
) -> nsresult
/**
* The pipe's input end, which also implements nsISearchableInputStream.
* Getting fails if the pipe hasn't been initialized.
*/
[must_use] readonly attribute nsIAsyncInputStream inputStream;
pub unsafe fn GetOutputStream(
&self,
aOutputStream: *mut *const nsIAsyncOutputStream
) -> nsresult
[src]
&self,
aOutputStream: *mut *const nsIAsyncOutputStream
) -> nsresult
/**
* The pipe's output end. Getting fails if the pipe hasn't been
* initialized.
*/
[must_use] readonly attribute nsIAsyncOutputStream outputStream;
Methods from Deref<Target = nsISupports>
pub fn coerce<T: nsISupportsCoerce>(&self) -> &T
[src]
Cast this nsISupports
to one of its base interfaces.
pub unsafe fn QueryInterface(
&self,
uuid: &nsIID,
result: *mut *mut c_void
) -> nsresult
[src]
&self,
uuid: &nsIID,
result: *mut *mut c_void
) -> nsresult
void QueryInterface (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result);
pub unsafe fn AddRef(&self) -> nsrefcnt
[src]
[noscript,notxpcom] nsrefcnt AddRef ();
pub unsafe fn Release(&self) -> nsrefcnt
[src]
[noscript,notxpcom] nsrefcnt Release ();
Trait Implementations
impl XpCom for nsIPipe
[src]
const IID: nsIID
IID: nsIID = nsID(634445459, 26718, 20132, [149, 211, 216, 132, 227, 29, 246, 60])
fn query_interface<T: XpCom>(&self) -> Option<RefPtr<T>>
[src]
Perform a QueryInterface call on this object, attempting to dynamically cast it to the requested interface type. Returns Some(RefPtr) if the cast succeeded, and None otherwise. Read more
impl RefCounted for nsIPipe
[src]
unsafe fn addref(&self)
[src]
Increment the reference count.
unsafe fn release(&self)
[src]
Decrement the reference count, potentially freeing backing memory.
impl Deref for nsIPipe
[src]
type Target = nsISupports
The resulting type after dereferencing.
fn deref(&self) -> &nsISupports
[src]
Dereferences the value.