# Struct ethcore_light::net::buffer_flow::FlowParams [−] [src]

    pub struct FlowParams { /* fields omitted */ }

A buffer-flow manager handles costs, recharge, limits

## Methods

### `impl FlowParams`
[src]

#### `fn new(limit: U256, costs: CostTable, recharge: U256) -> Self`

Create new flow parameters from a request cost table, buffer limit, and (minimum) rate of recharge.

#### `fn free() -> Self`

Create effectively infinite flow params.

#### `fn limit(&self) -> &U256`

Get a reference to the buffer limit.

#### `fn cost_table(&self) -> &CostTable`

Get a reference to the cost table.

#### `fn recharge_rate(&self) -> &U256`

Get a reference to the recharge rate.

#### `fn compute_cost(&self, kind: Kind, amount: usize) -> U256`

Compute the actual cost of a request, given the kind of request and number of requests made.

#### `fn max_amount(&self, buffer: &Buffer, kind: Kind) -> usize`

Compute the maximum number of costs of a specific kind which can be made with the given buffer. Saturates at `usize::max()`. This is not a problem in practice because this amount of requests is already prohibitively large.

#### `fn create_buffer(&self) -> Buffer`

Create initial buffer parameter.

#### `fn recharge(&self, buf: &mut Buffer)`

Recharge the buffer based on time passed since last update.

#### `fn refund(&self, buf: &mut Buffer, refund_amount: U256)`

Refund some buffer which was previously deducted. Does not update the recharge timestamp.

## Trait Implementations

### `impl Debug for FlowParams`
[src]

#### `fn fmt(&self, __arg_0: &mut Formatter) -> Result`

Formats the value using the given formatter.

### `impl Clone for FlowParams`
[src]

#### `fn clone(&self) -> FlowParams`

Returns a copy of the value. Read more

#### `fn clone_from(&mut self, source: &Self)`
1.0.0

Performs copy-assignment from `source`. Read more

### `impl PartialEq for FlowParams`
[src]

#### `fn eq(&self, __arg_0: &FlowParams) -> bool`

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `fn ne(&self, __arg_0: &FlowParams) -> bool`

This method tests for `!=`.

### `impl Default for FlowParams`
[src]

#### `fn default() -> Self`

Returns the "default value" for a type. Read more

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)