// use pulsar::{ // message::proto, producer, Error as PulsarError, Pulsar, SerializeMessage, TokioExecutor, // }; // use serde::{Deserialize, Serialize}; // #[derive(Serialize, Deserialize)] // struct TestData { // data: String, // } // impl SerializeMessage for TestData { // fn serialize_message(input: Self) -> Result { // let payload = serde_json::to_vec(&input).map_err(|e| PulsarError::Custom(e.to_string()))?; // Ok(producer::Message { // payload, // ..Default::default() // }) // } // } // #[tokio::main] // async fn main() -> Result<(), pulsar::Error> { // env_logger::init(); // let addr = "pulsar://127.0.0.1:6650"; // let pulsar: Pulsar<_> = Pulsar::builder(addr, TokioExecutor).build().await?; // let mut producer = pulsar // .producer() // .with_topic("persistent://public/default/test") // .with_name("my producer") // .with_options(producer::ProducerOptions { // schema: Some(proto::Schema { // r#type: proto::schema::Type::String as i32, // ..Default::default() // }), // ..Default::default() // }) // .build() // .await?; // let mut counter = 0usize; // loop { // producer // .send(TestData { // data: "data".to_string(), // }) // .await?; // counter += 1; // println!("{} messages", counter); // tokio::time::sleep(std::time::Duration::from_millis(2000)).await; // } // } // use rumqttc::{MqttOptions, AsyncClient, QoS}; // use tokio::{task, time}; // use std::time::Duration; // use std::error::Error; // #[tokio::main] // async fn main () { // let mut mqttoptions = MqttOptions::new("rumqtt-async", "47.104.81.55", 1883); // mqttoptions.set_keep_alive(Duration::from_secs(5)); // let (mut client, mut eventloop) = AsyncClient::new(mqttoptions, 10); // client.subscribe("545", QoS::AtMostOnce).await.unwrap(); // // task::spawn(async move { // // for i in 0..10 { // // client.publish("/comm/mk110/12", QoS::AtLeastOnce, false, vec![i; i as usize]).await.unwrap(); // // time::sleep(Duration::from_millis(1000)).await; // // } // // }); // while let Ok(notification) = eventloop.poll().await { // println!("Received = {:?}", notification); // } // } // use std::io::Write; // use clap::Command; // fn main() -> Result<(), String> { // loop { // let line = readline()?; // let line = line.trim(); // if line.is_empty() { // continue; // } // match respond(line) { // Ok(quit) => { // if quit { // break; // } // } // Err(err) => { // write!(std::io::stdout(), "{}", err).map_err(|e| e.to_string())?; // std::io::stdout().flush().map_err(|e| e.to_string())?; // } // } // } // Ok(()) // } // fn respond(line: &str) -> Result { // let args = shlex::split(line).ok_or("error: Invalid quoting")?; // let matches = cli() // .try_get_matches_from(&args) // .map_err(|e| e.to_string())?; // match matches.subcommand() { // Some(("ping", _matches)) => { // write!(std::io::stdout(), "Pong").map_err(|e| e.to_string())?; // std::io::stdout().flush().map_err(|e| e.to_string())?; // } // Some(("quit", _matches)) => { // write!(std::io::stdout(), "Exiting ...").map_err(|e| e.to_string())?; // std::io::stdout().flush().map_err(|e| e.to_string())?; // return Ok(true); // } // Some((name, _matches)) => unimplemented!("{}", name), // None => unreachable!("subcommand required"), // } // Ok(false) // } // fn cli() -> Command { // // strip out usage // const PARSER_TEMPLATE: &str = "\ // {all-args} // "; // // strip out name/version // const APPLET_TEMPLATE: &str = "\ // {about-with-newline}\n\ // {usage-heading}\n {usage}\n\ // \n\ // {all-args}{after-help}\ // "; // Command::new("repl") // .multicall(true) // .arg_required_else_help(true) // .subcommand_required(true) // .subcommand_value_name("APPLET") // .subcommand_help_heading("APPLETS") // .help_template(PARSER_TEMPLATE) // .subcommand( // Command::new("ping") // .about("Get a response") // .help_template(APPLET_TEMPLATE), // ) // .subcommand( // Command::new("quit") // .alias("exit") // .about("Quit the REPL") // .help_template(APPLET_TEMPLATE), // ) // } // fn readline() -> Result { // write!(std::io::stdout(), "$ ").map_err(|e| e.to_string())?; // std::io::stdout().flush().map_err(|e| e.to_string())?; // let mut buffer = String::new(); // std::io::stdin() // .read_line(&mut buffer) // .map_err(|e| e.to_string())?; // Ok(buffer) // } // use anyhow::{anyhow, Result}; // use futures::{StreamExt, TryStreamExt}; // use k8s_openapi::api::core::v1::Pod; // use kube::{ // api::{Api, LogParams}, // Client, // }; // use std::env; // use tracing::*; // #[tokio::main] // async fn main() -> Result<()> { // tracing_subscriber::fmt::init(); // let client = Client::try_default().await?; // let mypod = env::args() // .nth(1) // .ok_or_else(|| anyhow!("Usage: log_follow "))?; // info!("Fetching logs for {:?}", mypod); // let pods: Api = Api::default_namespaced(client); // let mut logs = pods // .log_stream(&mypod, &LogParams { // follow: true, // tail_lines: Some(1), // ..LogParams::default() // }) // .await? // .boxed(); // while let Some(line) = logs.try_next().await? { // info!("{:?}", String::from_utf8_lossy(&line)); // } // Ok(()) // } mod settings; #[macro_use] extern crate log; use settings::Settings; fn main() { // RUST_LOG=debug env_logger::init(); let settings = Settings::new(); info!("dolph starting up"); info!("{:?}", settings); }