var searchIndex = {}; searchIndex["gj"] = {"doc":"A library providing high-level abstractions for event loop concurrency,\nheavily borrowing ideas from [KJ](https://capnproto.org/cxxrpc.html#kj-concurrency-framework).\nAllows for coordination of asynchronous tasks using [promises](struct.Promise.html) as\na basic building block.","items":[[3,"Promise","gj","A computation that might eventually resolve to a value of type `T` or to an error\nof type `E`. Dropping the promise cancels the computation.",null,null],[3,"WaitScope","","A scope in which asynchronous programming can occur. Corresponds to the top level scope\nof some [event loop](struct.EventLoop.html). Can be used to [wait](struct.Promise.html#method.wait)\nfor the result of a promise.",null,null],[3,"ForkedPromise","","The result of `Promise::fork()`. Allows branches to be created. Dropping the `ForkedPromise`\nalong with any branches created through `add_branch()` will cancel the computation.",null,null],[3,"EventLoop","","A queue of events being executed in a loop on a single thread.",null,null],[3,"PromiseFulfiller","","A handle that can be used to fulfill or reject a promise. If you think of a promise\nas the receiving end of a oneshot channel, then this is the sending end.",null,null],[3,"TaskSet","","Holds a collection of `Promise<T, E>`s and ensures that each executes to completion.\nDestroying a `TaskSet` automatically cancels all of its unfinished promises.",null,null],[0,"io","","Asynchronous input and output.",null,null],[3,"Error","gj::io","A `::std::io::Error` that also carries along some state. Useful for tasks from which you want to\nreturn the state in both the error and the success cases, like `Promise<S, Error<S>>`.",null,null],[12,"state","","",0,null],[12,"error","","",0,null],[3,"Slice","","",null,null],[12,"buf","","",1,null],[12,"end","","",1,null],[3,"Timer","","",null,null],[0,"tcp","","TCP sockets.",null,null],[3,"Stream","gj::io::tcp","",null,null],[3,"Listener","","",null,null],[3,"Reader","","",null,null],[3,"Writer","","",null,null],[11,"drop","","",2,null],[11,"bind","","",2,{"inputs":[{"name":"socketaddr"}],"output":{"name":"result"}}],[11,"accept","","",2,null],[11,"read","","",3,null],[11,"write","","",3,null],[11,"flush","","",3,null],[11,"drop","","",3,null],[11,"connect","","",3,{"inputs":[{"name":"socketaddr"}],"output":{"name":"promise"}}],[11,"try_clone","","",3,null],[11,"split","","",3,null],[11,"from_raw_fd","","",3,{"inputs":[{"name":"rawfd"}],"output":{"name":"result"}}],[11,"try_read","","",3,null],[11,"write","","",3,null],[11,"read","","",4,null],[11,"try_read","","",4,null],[11,"write","","",5,null],[11,"flush","","",5,null],[11,"write","","",5,null],[0,"unix","gj::io","Unix domain sockets.",null,null],[3,"Stream","gj::io::unix","",null,null],[3,"Listener","","",null,null],[3,"Reader","","",null,null],[3,"Writer","","",null,null],[5,"spawn","","Creates a new thread and sets up a socket pair that can be used to communicate with it.\nPasses one of the sockets to the thread's start function and returns the other socket.\nThe new thread will already have an active event loop when `start_func` is called.",null,{"inputs":[{"name":"f"}],"output":{"name":"result"}}],[11,"drop","","",6,null],[11,"bind","","",6,{"inputs":[{"name":"p"}],"output":{"name":"result"}}],[11,"accept","","",6,null],[11,"read","","",7,null],[11,"write","","",7,null],[11,"flush","","",7,null],[11,"drop","","",7,null],[11,"connect","","",7,{"inputs":[{"name":"p"}],"output":{"name":"promise"}}],[11,"new_pair","","",7,{"inputs":[],"output":{"name":"result"}}],[11,"try_clone","","",7,null],[11,"split","","",7,null],[11,"from_raw_fd","","Consumes a raw file descriptor to creates a `Stream`. Ensures that O_NONBLOCK is set on the\ndescriptor.",7,{"inputs":[{"name":"rawfd"}],"output":{"name":"result"}}],[11,"try_read","","",7,null],[11,"write","","",7,null],[11,"read","","",8,null],[11,"try_read","","",8,null],[11,"write","","",9,null],[11,"flush","","",9,null],[11,"write","","",9,null],[8,"AsyncRead","gj::io","A nonblocking input bytestream.",null,null],[10,"try_read","","Attempts to read `buf.len()` bytes from the stream, writing them into `buf`.\nReturns `self`, the modified `buf`, and the number of bytes actually read.\nReturns as soon as `min_bytes` are read or EOF is encountered.",10,null],[11,"read","","Like `try_read()`, but returns an error if EOF is encountered before `min_bytes`\ncan be read.",10,null],[8,"AsyncWrite","","A nonblocking output bytestream.",null,null],[10,"write","","Attempts to write all `buf.len()` bytes from `buf` into the stream. Returns `self` and `buf`\nonce all of the bytes have been written.",11,null],[11,"new","","",0,{"inputs":[{"name":"s"},{"name":"error"}],"output":{"name":"error"}}],[11,"into","","",0,null],[11,"into","","",0,null],[11,"new","","",1,{"inputs":[{"name":"t"},{"name":"usize"}],"output":{"name":"slice"}}],[11,"as_ref","","",1,null],[11,"after_delay","","",12,null],[11,"timeout_after","","",12,null],[8,"FulfillerDropped","gj","Specifies an error to generate when a [`PromiseFulfiller`](struct.PromiseFulfiller.html) is\ndropped.",null,null],[10,"fulfiller_dropped","","",13,{"inputs":[],"output":{"name":"self"}}],[8,"TaskReaper","","Callbacks to be invoked when a task in a [`TaskSet`](struct.TaskSet.html) finishes. You are\nrequired to implement at least the failure case.",null,null],[11,"task_succeeded","","",14,null],[10,"task_failed","","",14,null],[11,"ok","","Creates a new promise that has already been fulfilled with the given value.",15,{"inputs":[{"name":"t"}],"output":{"name":"promise"}}],[11,"err","","Creates a new promise that has already been rejected with the given error.",15,{"inputs":[{"name":"e"}],"output":{"name":"promise"}}],[11,"never_done","","Creates a new promise that never resolves.",15,{"inputs":[],"output":{"name":"promise"}}],[11,"and_fulfiller","","Creates a new promise/fulfiller pair.",15,null],[11,"then_else","","Chains further computation to be executed once the promise resolves.\nWhen the promise is fulfilled or rejected, invokes `func` on its result.",15,null],[11,"then","","Calls `then_else()` with a default error handler that simply propagates all errors.",15,null],[11,"map_else","","Like `then_else()` but for a `func` that returns a direct value rather than a promise. As an\noptimization, execution of `func` is delayed until its result is known to be needed. The\nexpectation here is that `func` is just doing some transformation on the results, not\nscheduling any other actions, and therefore the system does not need to be proactive about\nevaluating it. This way, a chain of trivial `map()` transformations can be executed all at\nonce without repeated rescheduling through the event loop. Use the `eagerly_evaluate()`\nmethod to suppress this behavior.",15,null],[11,"map","","Calls `map_else()` with a default error handler that simply propagates all errors.",15,null],[11,"map_err","","Transforms the error branch of the promise.",15,null],[11,"lift","","Maps errors into a more general type.",15,null],[11,"exclusive_join","","Returns a new promise that resolves when either `self` or `other` resolves. The promise that\ndoesn't resolve first is cancelled.",15,null],[11,"all","","Transforms a collection of promises into a promise for a vector. If any of\nthe promises fails, immediately cancels the remaining promises.",15,{"inputs":[{"name":"i"}],"output":{"name":"promise"}}],[11,"fork","","Forks the promise, so that multiple different clients can independently wait on the result.",15,null],[11,"attach","","Holds onto `value` until the promise resolves, then drops `value`.",15,null],[11,"eagerly_evaluate","","Forces eager evaluation of this promise. Use this if you are going to hold on to the promise\nfor a while without consuming the result, but you want to make sure that the system actually\nprocesses it.",15,null],[11,"wait","","Runs the event loop until the promise is fulfilled.",15,null],[11,"add_branch","","Creates a new promise that will resolve when the originally forked promise resolves.",16,null],[11,"top_level","","Creates an event loop for the current thread, panicking if one already exists. Runs the given\nclosure and then drops the event loop.",17,{"inputs":[{"name":"f"}],"output":{"name":"result"}}],[11,"fulfill","","",18,null],[11,"reject","","",18,null],[11,"drop","","",18,null],[11,"new","","",19,{"inputs":[{"name":"box"}],"output":{"name":"taskset"}}],[11,"add","","",19,null],[14,"pry!","","Like `try!()`, but for functions that return a [`Promise<T, E>`](struct.Promise.html) rather\nthan a `Result<T, E>`.",null,null]],"paths":[[3,"Error"],[3,"Slice"],[3,"Listener"],[3,"Stream"],[3,"Reader"],[3,"Writer"],[3,"Listener"],[3,"Stream"],[3,"Reader"],[3,"Writer"],[8,"AsyncRead"],[8,"AsyncWrite"],[3,"Timer"],[8,"FulfillerDropped"],[8,"TaskReaper"],[3,"Promise"],[3,"ForkedPromise"],[3,"EventLoop"],[3,"PromiseFulfiller"],[3,"TaskSet"]]}; initSearch(searchIndex);