Struct consul_rs::api::ConsulConfig[][src]

pub struct ConsulConfig {
    pub config: Option<Config>,
    pub watch_services: Option<Vec<WatchService>>,
}

Fields

config: Option<Config>watch_services: Option<Vec<WatchService>>

Implementations

service_register is used to register a new service with the local agent

use consul_rs::api::CONSUL_CONFIG;
use async_std::task::block_on;
use consul_rs::agent::AgentServiceRegistration;
let clone_consul = CONSUL_CONFIG.clone();
let consul = block_on(clone_consul.read());
let mut service = AgentServiceRegistration::default();
service.ID = Some(String::from("321"));
service.Name = Some(String::from("test"));
service.Port = Some(8080);
service.Address = Some(String::from("127.0.0.1"));
let s = block_on(consul.service_register(&service)).unwrap();
println!("{}", s);

service_deregister is used to register a new service with the local agent

use consul_rs::api::CONSUL_CONFIG;
use async_std::task::block_on;
use consul_rs::ConsulTrait;
use consul_rs::agent::AgentServiceRegistration;
let clone_consul = CONSUL_CONFIG.clone();
let consul = block_on(clone_consul.read());
let service_id = String::from("321");
let s = block_on(consul.service_deregister(service_id)).unwrap();
println!("{}", s);

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more