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,"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],[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.",6,null],[11,"read","","Like `try_read()`, but returns an error if EOF is encountered before `min_bytes`\ncan be read.",6,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.",7,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","","",8,null],[11,"timeout_after","","",8,null],[8,"FulfillerDropped","gj","Specifies an error to generate when a [`PromiseFulfiller`](struct.PromiseFulfiller.html) is\ndropped.",null,null],[10,"fulfiller_dropped","","",9,{"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","","",10,null],[10,"task_failed","","",10,null],[11,"ok","","Creates a new promise that has already been fulfilled with the given value.",11,{"inputs":[{"name":"t"}],"output":{"name":"promise"}}],[11,"err","","Creates a new promise that has already been rejected with the given error.",11,{"inputs":[{"name":"e"}],"output":{"name":"promise"}}],[11,"never_done","","Creates a new promise that never resolves.",11,{"inputs":[],"output":{"name":"promise"}}],[11,"and_fulfiller","","Creates a new promise/fulfiller pair.",11,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.",11,null],[11,"then","","Calls `then_else()` with a default error handler that simply propagates all errors.",11,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.",11,null],[11,"map","","Calls `map_else()` with a default error handler that simply propagates all errors.",11,null],[11,"map_err","","Transforms the error branch of the promise.",11,null],[11,"lift","","Maps errors into a more general type.",11,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.",11,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.",11,{"inputs":[{"name":"i"}],"output":{"name":"promise"}}],[11,"fork","","Forks the promise, so that multiple different clients can independently wait on the result.",11,null],[11,"attach","","Holds onto `value` until the promise resolves, then drops `value`.",11,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.",11,null],[11,"wait","","Runs the event loop until the promise is fulfilled.",11,null],[11,"add_branch","","Creates a new promise that will resolve when the originally forked promise resolves.",12,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.",13,{"inputs":[{"name":"f"}],"output":{"name":"result"}}],[11,"fulfill","","",14,null],[11,"reject","","",14,null],[11,"drop","","",14,null],[11,"new","","",15,{"inputs":[{"name":"box"}],"output":{"name":"taskset"}}],[11,"add","","",15,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"],[8,"AsyncRead"],[8,"AsyncWrite"],[3,"Timer"],[8,"FulfillerDropped"],[8,"TaskReaper"],[3,"Promise"],[3,"ForkedPromise"],[3,"EventLoop"],[3,"PromiseFulfiller"],[3,"TaskSet"]]}; initSearch(searchIndex);