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`.",null,null],[3,"WaitScope","","A scope in which asynchronous programming can occur. Corresponds to the top level scope\nof some event loop.",null,null],[3,"ForkedPromise","","The result of Promise::fork(). Allows branches to be created.",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","",null,null],[12,"state","","",0,null],[12,"error","","",0,null],[3,"Slice","","",null,null],[12,"buf","","",1,null],[12,"end","","",1,null],[3,"MioEventPort","","",null,null],[3,"Timer","","",null,null],[0,"tcp","","",null,null],[3,"Stream","gj::io::tcp","",null,null],[3,"Listener","","",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,"from_raw_fd","","",3,{"inputs":[{"name":"rawfd"}],"output":{"name":"result"}}],[11,"try_read","","",3,null],[11,"write","","",3,null],[0,"unix","gj::io","",null,null],[3,"Stream","gj::io::unix","",null,null],[3,"Listener","","",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","","",4,null],[11,"bind","","",4,{"inputs":[{"name":"p"}],"output":{"name":"result"}}],[11,"accept","","",4,null],[11,"read","","",5,null],[11,"write","","",5,null],[11,"flush","","",5,null],[11,"drop","","",5,null],[11,"connect","","",5,{"inputs":[{"name":"p"}],"output":{"name":"promise"}}],[11,"try_clone","","",5,null],[11,"from_raw_fd","","",5,{"inputs":[{"name":"rawfd"}],"output":{"name":"result"}}],[11,"try_read","","",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,"new","","",8,{"inputs":[],"output":{"name":"result"}}],[11,"after_delay_ms","","",9,null],[11,"timeout_after_ms","","",9,null],[8,"FulfillerDropped","gj","Specifies an error to generate when a PromiseFulfiller is dropped.",null,null],[10,"fulfiller_dropped","","",10,{"inputs":[],"output":{"name":"self"}}],[8,"TaskReaper","","Callbacks to be invoked when a task in a `TaskSet` finishes. You are required to\nimplement at least the failure case.",null,null],[11,"task_succeeded","","",11,null],[10,"task_failed","","",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.",12,null],[11,"then","","Calls `then_else()` with a default error handler that simply propagates all errors.",12,null],[11,"map_else","","Like then_else() but for a `func` that returns a direct value rather than a promise.",12,null],[11,"map","","Calls `map_else()` with a default error handler that simply propagates all errors.",12,null],[11,"map_err","","Transforms the error branch of the promise.",12,null],[11,"lift","","Maps errors into a more general type.",12,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.",12,null],[11,"ok","","Creates a new promise that has already been fulfilled.",12,{"inputs":[{"name":"t"}],"output":{"name":"promise"}}],[11,"err","","Creates a new promise that has already been rejected with the given error.",12,{"inputs":[{"name":"e"}],"output":{"name":"promise"}}],[11,"never_done","","Creates a new promise that never gets fulfilled.",12,{"inputs":[],"output":{"name":"promise"}}],[11,"and_fulfiller","","Creates a new promise/fulfiller pair.",12,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.",12,{"inputs":[{"name":"i"}],"output":{"name":"promise"}}],[11,"fork","","Forks the promise, so that multiple different clients can independently wait on the result.",12,null],[11,"eagerly_evaluate","","",12,null],[11,"wait","","Runs the event loop until the promise is fulfilled.",12,null],[11,"add_branch","","",13,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.",14,{"inputs":[{"name":"f"}],"output":{"name":"result"}}],[11,"fulfill","","",15,null],[11,"reject","","",15,null],[11,"drop","","",15,null],[11,"new","","",16,{"inputs":[{"name":"box"}],"output":{"name":"taskset"}}],[11,"add","","",16,null],[14,"pry!","","Like `try!()`, but for functions that return a `Promise<T, E>` rather than a `Result<T, E>`.",null,null]],"paths":[[3,"Error"],[3,"Slice"],[3,"Listener"],[3,"Stream"],[3,"Listener"],[3,"Stream"],[8,"AsyncRead"],[8,"AsyncWrite"],[3,"MioEventPort"],[3,"Timer"],[8,"FulfillerDropped"],[8,"TaskReaper"],[3,"Promise"],[3,"ForkedPromise"],[3,"EventLoop"],[3,"PromiseFulfiller"],[3,"TaskSet"]]}; initSearch(searchIndex);