From 583a47764a93465ce8d846a6a7273a9bd38fd554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kot?= Date: Thu, 30 Sep 2021 22:23:23 +0200 Subject: Change FileExtensions signature --- examples/async_source/main.rs | 10 +++++----- examples/custom_format/main.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'examples') diff --git a/examples/async_source/main.rs b/examples/async_source/main.rs index 005a473..02f8cd7 100644 --- a/examples/async_source/main.rs +++ b/examples/async_source/main.rs @@ -1,6 +1,6 @@ -use std::error::Error; +use std::{collections::HashMap, error::Error, fmt::Debug}; -use config::{builder::AsyncState, AsyncSource, ConfigBuilder, ConfigError, FileFormat, Map}; +use config::{AsyncSource, ConfigBuilder, ConfigError, FileFormat, Format, builder::AsyncState, Map}; use async_trait::async_trait; use futures::{select, FutureExt}; @@ -49,13 +49,13 @@ async fn run_client() -> Result<(), Box> { // Actual implementation of AsyncSource can be found below #[derive(Debug)] -struct HttpSource { +struct HttpSource { uri: String, - format: FileFormat, + format: F, } #[async_trait] -impl AsyncSource for HttpSource { +impl AsyncSource for HttpSource { async fn collect(&self) -> Result, ConfigError> { reqwest::get(&self.uri) .await diff --git a/examples/custom_format/main.rs b/examples/custom_format/main.rs index 981dcb4..c149436 100644 --- a/examples/custom_format/main.rs +++ b/examples/custom_format/main.rs @@ -49,7 +49,7 @@ impl Format for MyFormat { // It is only required for File source, custom sources can use Format without caring for extensions static MY_FORMAT_EXT: Vec<&'static str> = vec![]; impl FileExtensions for MyFormat { - fn extensions(&self) -> &Vec<&'static str> { + fn extensions(&self) -> &'static [&'static str] { &MY_FORMAT_EXT } } -- cgit v1.2.3