var searchIndex = {}; searchIndex["cobalt"] = {"doc":"**cobalt** is a networking library which provides [virtual connections\nover UDP](http://gafferongames.com/networking-for-game-programmers/udp-vs-tcp/)\nalong with a messaging layer for sending both unreliable, reliable as well\nas ordered messages.","items":[[3,"Config","cobalt","Structure defining connection and message configuration options.",null,null],[12,"send_rate","","Number of packets send per second. Default is `30`.",0,null],[12,"packet_max_size","","Maximum bytes that can be received / send in one packet. Default\n`1400`.",0,null],[12,"protocol_header","","32-Bit Protocol ID used to identify UDP related packets. Default is\n`[1, 2, 3, 4]`.",0,null],[12,"packet_drop_threshold","","Maximum roundtrip-time in milliseconds before a packet is considered\nlost. Default is `1000`.",0,null],[12,"connection_init_threshold","","Maximum time in milliseconds until the first packet must be received\nbefore a connection attempt fails. Default is `100`.",0,null],[12,"connection_drop_threshold","","Maximum time in milliseconds between any two packets before the\nconnection gets dropped. Default is `1000`.",0,null],[12,"message_quota_instant","","The percent of available packet bytes to use when serializing\n`MessageKind::Instant` into a packet via a `MessageQueue`.",0,null],[12,"message_quota_reliable","","The percent of available packet bytes to use when serializing\n`MessageKind::Reliable` into a packet via a `MessageQueue`.",0,null],[12,"message_quota_ordered","","The percent of available packet bytes to use when serializing\n`MessageKind::Ordered` into a packet via a `MessageQueue`.",0,null],[3,"Connection","","Implementation of a reliable, virtual connection logic.",null,null],[3,"ConnectionID","","Representation of a random id for connection identification.",null,null],[12,"0","","",1,null],[3,"BinaryRateLimiter","","Implementation of a binary state rate limiter for congestion avoidance.",null,null],[3,"UdpSocket","","Non-blocking abstraction over a UDP socket.",null,null],[3,"Stats","","A structure containing stats data average of the course of one second.",null,null],[12,"bytes_sent","","Average number of bytes received over the last second.",2,null],[12,"bytes_received","","Average number of bytes received over the last second.",2,null],[3,"Client","","Implementation of a single-server client with handler based event dispatch.",null,null],[3,"ClientState","","A structure used for synchronous calls on a `Client` instance.",null,null],[3,"Server","","Implementation of a multi-client server with handler based event dispatch.",null,null],[4,"ConnectionState","","Enum indicating the state of a connection.",null,null],[13,"Connecting","","The connection has been opened but has yet to receive the first\nincoming packet.",3,null],[13,"Connected","","The remote has responded and at least one incoming packet has been\nreceived.",3,null],[13,"FailedToConnect","","The remote did not respond with the first packet within the maximum\nconfigured time frame for establishing a connection.",3,null],[13,"Lost","","The remote did not send any packets within the maximum configured time\nframe between any two packets.",3,null],[13,"Closed","","The connection has been closed programmatically.",3,null],[4,"MessageKind","","Enum for specification of a message handling algorithm.",null,null],[13,"Instant","","Message that is going be send exactly once and ignored in case its\ncontaining packet is lost. No guarantees are made as for the order in\nwhich a message of this kind is going to be received by a remote queue.",4,null],[13,"Reliable","","Message that is going to be re-send in case its containing packet is\nlost. No guarantees are made as for the order in which a message of\nthis kind is going to be received by a remote queue.",4,null],[13,"Ordered","","Message that is going to be re-send in case its containing packet is\nlost and is also guaranteed to arrive in-order, meaning that if you send\ntwo `Ordered` messages and the second arrives first in the remote queue\n, the remote queue will buffer the second message until the first one\narrives and then make both of them available to the application at\nonce.",4,null],[13,"Invalid","","Invalid message which for some reason could not be parsed correctly\nfrom the available packet data.",4,null],[11,"fmt","","",5,null],[11,"new","","Creates a new client with the given configuration.",5,{"inputs":[{"name":"config"}],"output":{"name":"client"}}],[11,"peer_addr","","Returns the address of the server the client is currently connected to.",5,null],[11,"local_addr","","Returns the local address that the client is sending from.",5,null],[11,"stats","","Returns statistics (i.e. bandwidth usage) for the last second.",5,null],[11,"set_config","","Overrides the client's existing configuration.",5,null],[11,"connect","","Establishes a connection with the server at the specified address by\ncreating a local socket for message sending.",5,null],[11,"connect_from_socket","","Establishes a connection with the server at the specified address by\nusing the specified socket for message sending.",5,null],[11,"close","","Asynchronously closes the connection to the server.",5,null],[11,"connect_sync","","Establishes a connection with the server at the specified address by\ncreating a local socket for message sending.",5,null],[11,"connect_from_socket_sync","","Establishes a connection with the server at the specified address by\nusing the specified socket for message sending.",5,null],[11,"receive_sync","","Receives all currently buffered incoming packet from the underlying\nconnection.",5,null],[11,"tick_sync","","Performs exactly on tick of the underlying connection.",5,null],[11,"send_sync","","Sends exactly on outgoing packet from the underlying connection.",5,null],[11,"close_sync","","Closes the connection to the server.",5,null],[11,"fmt","","",6,null],[11,"rtt","","Returns the average roundtrip time for this client's underlying\nconnection.",6,null],[11,"packet_loss","","Returns the percent of packets that were sent and never acknowledged\nover the total number of packets that have been send across this\nclient's underlying connection.",6,null],[11,"stats","","Returns statistics (i.e. bandwidth usage) for the last second, of this\nclient'sunderlying connection.",6,null],[11,"local_addr","","Returns the socket address for the local end of this client's\nunderlying connection.",6,null],[11,"peer_addr","","Returns the socket address for the remote end of this client's\nunderlying connection.",6,null],[11,"set_config","","Overrides the configuration of this client's underlying connection.",6,null],[11,"send","","Sends a message of the specified `kind` along with its `payload` over\nthis client's underlying connection.",6,null],[11,"reset","","Resets this client's underlying connection state.",6,null],[11,"fmt","","",7,null],[11,"new","","Creates a new server with the given configuration.",7,{"inputs":[{"name":"config"}],"output":{"name":"server"}}],[11,"local_addr","","Returns the local address that the server is bound to.",7,null],[11,"stats","","Returns statistics (i.e. bandwidth usage) for the last second.",7,null],[11,"bind","","Binds the server to the specified local address by creating a socket\nand actively listens for incoming client connections.",7,null],[11,"bind_to_socket","","Binds the server to specified socket and actively listens for incoming\nclient connections.",7,null],[11,"shutdown","","Shuts down the server, closing all active client connections.",7,null],[11,"fmt","","",8,null],[11,"new","","Creates a new rate limiter.",8,{"inputs":[{"name":"config"}],"output":{"name":"box"}}],[11,"update","","",8,null],[11,"congested","","",8,null],[11,"should_send","","",8,null],[11,"reset","","",8,null],[11,"fmt","","",0,null],[11,"clone","","",0,null],[11,"default","","",0,{"inputs":[],"output":{"name":"config"}}],[11,"eq","","",3,null],[11,"fmt","","",3,null],[11,"clone","","",3,null],[11,"clone","","",1,null],[11,"hash","","",1,null],[11,"eq","","",1,null],[11,"ne","","",1,null],[11,"fmt","","",1,null],[11,"fmt","","",9,null],[11,"new","","Creates a new Virtual Connection over the given `SocketAddr`.",9,{"inputs":[{"name":"config"},{"name":"socketaddr"},{"name":"socketaddr"},{"name":"box"}],"output":{"name":"connection"}}],[11,"id_from_packet","","Extracts a `ConnectionID` from packet with a valid protocol header.",9,null],[11,"open","","Returns whether the connection is currently accepting any incoming\npackets.",9,null],[11,"congested","","Returns whether the connection is currently congested and should be\nsending less packets per second in order to resolve the congestion.",9,null],[11,"id","","Returns the id of the connection.",9,null],[11,"set_id","","Overrides the id of the connection.",9,null],[11,"state","","Returns the current state of the connection.",9,null],[11,"rtt","","Returns the average roundtrip time for the connection.",9,null],[11,"packet_loss","","Returns the percent of packets that were sent and never acknowledged\nover the total number of packets that have been send across the\nconnection.",9,null],[11,"local_addr","","Returns the socket address for the local end of this connection.",9,null],[11,"peer_addr","","Returns the socket address for the remote end of this connection.",9,null],[11,"set_peer_addr","","Sets the socket address of the remote peer of this connection.",9,null],[11,"set_config","","Overrides the connection's existing configuration.",9,null],[11,"send","","Sends a message of the specified `kind` along with its `payload` over\nthe connection.",9,null],[11,"received","","Returns a consuming iterator over all messages received over this\nconnections.",9,null],[11,"receive_packet","","Receives a incoming UDP packet.",9,null],[11,"send_packet","","Send a new outgoing UDP packet.",9,null],[11,"reset","","Resets the connection for re-use with another address.",9,null],[11,"close","","Closes the connection, no further packets will be received or send.",9,null],[11,"eq","","",4,null],[11,"fmt","","",4,null],[11,"clone","","",4,null],[11,"new","","Tries to create a new UDP socket by binding to the specified address.",10,{"inputs":[{"name":"t"},{"name":"usize"}],"output":{"name":"result"}}],[11,"try_recv","","Attempts to return a incoming packet on this socket without blocking.",10,null],[11,"send_to","","Send data on the socket to the given address. On success, returns the\nnumber of bytes written.",10,null],[11,"local_addr","","Returns the socket address of the underlying `net::UdpSocket`.",10,null],[11,"shutdown","","Shuts down the socket by stopping its internal reader thread.",10,null],[11,"drop","","",10,null],[11,"fmt","","",10,null],[11,"clone","","",2,null],[11,"eq","","",2,null],[11,"ne","","",2,null],[11,"fmt","","",2,null],[11,"default","","",2,{"inputs":[],"output":{"name":"stats"}}],[6,"ConnectionMap","","Type alias for connection mappings.",null,null],[8,"Handler","","Trait for implementation of a client / server event proxy.",null,null],[11,"rate_limiter","","Method that returns a new `RateLimiter` instance for use with a\nfreshly instantiated `Connection`.",11,null],[11,"bind","","Method that is called once a `Server` has successfully bound itself\nto its local address.",11,null],[11,"tick_connections","","Method that is called each time a `Server` "ticks". A "tick" occurs\nin-between the receiving and sending data from / to connections.",11,null],[11,"shutdown","","Method that is called once a `Server` is going to shutdown.",11,null],[11,"connect","","Method that is called once a `Client` has successfully bound itself\nto its local address.",11,null],[11,"tick_connection","","Method that is called each time a `Client` "ticks". A "tick" occurs\nin-between the receiving and sending data from / to connections.",11,null],[11,"close","","Method that is called once a `Client` is going to close.",11,null],[11,"connection","","Method that is called each time a new connection is established.",11,null],[11,"connection_failed","","Method that is called each time a connection fails to establish.",11,null],[11,"connection_congestion_state","","Method that is called each time the congestion state of connection\nchanges.",11,null],[11,"connection_lost","","Method that is called each time a connection is lost and dropped.",11,null],[11,"connection_packet_lost","","Method that is called each time a packet send by a connection is lost.",11,null],[11,"connection_packet_compress","","Method that is called for in-place compression purposes before a packet\nis send over the connection's underlying socket.",11,null],[11,"connection_packet_decompress","","Method that is called for decompression purposes after a packet is\nreceived over the connection's underlying socket.",11,null],[8,"RateLimiter","","Trait for implementation of a network congestion avoidance algorithm.",null,null],[10,"update","","Method implementing a congestion avoidance algorithm based on round\ntrip time and packet loss.",12,null],[10,"congested","","Method that should return `true` in case the connection is currently\nconsidered congested and should reduce the number of packets it sends\nper second.",12,null],[10,"should_send","","Method that returns whether a connection should be currently sending\npackets or not.",12,null],[10,"reset","","Method that resets any internal state of the rate limiter.",12,null],[8,"Socket","","Trait for implementation of a non-blocking UDP socket.",null,null],[10,"try_recv","","Method that attempts to return a incoming packet on this socket without\nblocking.",13,null],[10,"send_to","","Method sending data on the socket to the given address. On success,\nreturns the number of bytes written.",13,null],[10,"local_addr","","Method returning the address of the actual, underlying socket.",13,null],[10,"shutdown","","Method for shutting down the socket.",13,null],[11,"rate_limiter","","Method that returns a new `RateLimiter` instance for use with a\nfreshly instantiated `Connection`.",11,null],[11,"bind","","Method that is called once a `Server` has successfully bound itself\nto its local address.",11,null],[11,"tick_connections","","Method that is called each time a `Server` "ticks". A "tick" occurs\nin-between the receiving and sending data from / to connections.",11,null],[11,"shutdown","","Method that is called once a `Server` is going to shutdown.",11,null],[11,"connect","","Method that is called once a `Client` has successfully bound itself\nto its local address.",11,null],[11,"tick_connection","","Method that is called each time a `Client` "ticks". A "tick" occurs\nin-between the receiving and sending data from / to connections.",11,null],[11,"close","","Method that is called once a `Client` is going to close.",11,null],[11,"connection","","Method that is called each time a new connection is established.",11,null],[11,"connection_failed","","Method that is called each time a connection fails to establish.",11,null],[11,"connection_congestion_state","","Method that is called each time the congestion state of connection\nchanges.",11,null],[11,"connection_lost","","Method that is called each time a connection is lost and dropped.",11,null],[11,"connection_packet_lost","","Method that is called each time a packet send by a connection is lost.",11,null],[11,"connection_packet_compress","","Method that is called for in-place compression purposes before a packet\nis send over the connection's underlying socket.",11,null],[11,"connection_packet_decompress","","Method that is called for decompression purposes after a packet is\nreceived over the connection's underlying socket.",11,null],[11,"fmt","","",12,null]],"paths":[[3,"Config"],[3,"ConnectionID"],[3,"Stats"],[4,"ConnectionState"],[4,"MessageKind"],[3,"Client"],[3,"ClientState"],[3,"Server"],[3,"BinaryRateLimiter"],[3,"Connection"],[3,"UdpSocket"],[8,"Handler"],[8,"RateLimiter"],[8,"Socket"]]}; initSearch(searchIndex);