Docs.rs
  • tcp-client-0.2.0
    • tcp-client 0.2.0
    • Permalink
    • Docs.rs crate page
    • MIT OR Apache-2.0
    • Links
    • Repository
    • crates.io
    • Source
    • Owners
    • xuxiaocheng0201
    • Dependencies
      • bytes ^1 normal
      • once_cell ^1 normal
      • serde ^1 normal optional
      • tcp-handler ^1 normal
      • thiserror ^1 normal
      • tokio ^1 normal
      • variable-len-reader ^3 normal
      • tokio ^1 dev
      • reportme >=0.2 build
    • Versions
    • 100% of the crate is documented
  • Platform
    • i686-pc-windows-msvc
    • i686-unknown-linux-gnu
    • x86_64-apple-darwin
    • x86_64-pc-windows-msvc
    • x86_64-unknown-linux-gnu
  • Feature flags
  • docs.rs
    • About docs.rs
    • Privacy policy
  • Rust
    • Rust website
    • The Book
    • Standard Library API Reference
    • Rust by Example
    • The Cargo Guide
    • Clippy Documentation

Crate tcp_client

tcp_client0.2.0

  • All Items

Sections

  • Tcp-Client
  • Description
  • Usage
  • Example
  • Version map
  • License

Crate Items

  • Re-exports
  • Modules
  • Macros

Crates

  • tcp_client

Crate tcp_client

Source
Expand description

§Tcp-Client

Crate Crates.io License

Read this in other languages: English, 简体中文.

§Description

Convenient client-side TCP service. Also see tcp-server for server-side.

Based on tcp-handler.

With complete API document.

§Usage

Add this to your Cargo.toml:

[dependencies]
tcp-client = "~0.2"

§Example

use tcp_client::define_client;
use tcp_client::errors::Result;

define_client!(pub CommonMyClient, MyClient, "MyTcpApplication");

impl MyClient {
    // define your method here.
    // example:
    async fn my_method(&mut self) -> Result<()> {
        self.check_func("my_method").await?;
        // ...
        Ok(())
    }
}

#[tokio::main]
async fn main() {
    let mut client = MyClient::connect("127.0.0.1:1234").await.unwrap();
    // use client.
    // example:
    client.my_method().await.unwrap();
}

§Version map

Versions map to tcp-server with the same protocol. (Recommended for use in conjunction, otherwise unexpected bugs may occur.)

client versionserver version
>=0.2.0>=0.3.0
<0.2.0, >=0.1.0<0.3.0 >=0.2.0
<0.1.0<0.2.0

§License

Licensed under either of

  • Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.

Re-exports§

pub extern crate bytes;
pub extern crate tcp_handler;

Modules§

config
Global configuration for this crate.
errors
The common errors.

Macros§

define_client
The main macro provided by this crate.

Results

Settings
Help
No results :(
Try on DuckDuckGo?

Or try looking in one of these:
  • The Rust Reference for technical details about the language.
  • Rust By Example for expository code examples.
  • The Rust Book for introductions to language features and the language itself.
  • Docs.rs for documentation of crates released on crates.io.
No results :(
Try on DuckDuckGo?

Or try looking in one of these:
  • The Rust Reference for technical details about the language.
  • Rust By Example for expository code examples.
  • The Rust Book for introductions to language features and the language itself.
  • Docs.rs for documentation of crates released on crates.io.
No results :(
Try on DuckDuckGo?

Or try looking in one of these:
  • The Rust Reference for technical details about the language.
  • Rust By Example for expository code examples.
  • The Rust Book for introductions to language features and the language itself.
  • Docs.rs for documentation of crates released on crates.io.