From c58f396845ee421fc818ed8999103b241b495f1c Mon Sep 17 00:00:00 2001 From: Simon Heath Date: Mon, 11 Dec 2017 13:25:50 -0500 Subject: Replaced path() method with associated const on ApiRequest trait --- ipfs-api/src/client.rs | 2 +- ipfs-api/src/request/add.rs | 5 +---- ipfs-api/src/request/bitswap.rs | 20 ++++------------- ipfs-api/src/request/block.rs | 20 ++++------------- ipfs-api/src/request/bootstrap.rs | 15 +++---------- ipfs-api/src/request/cat.rs | 5 +---- ipfs-api/src/request/commands.rs | 5 +---- ipfs-api/src/request/config.rs | 15 +++---------- ipfs-api/src/request/dag.rs | 10 ++------- ipfs-api/src/request/dht.rs | 30 ++++++-------------------- ipfs-api/src/request/diag.rs | 15 +++---------- ipfs-api/src/request/dns.rs | 5 +---- ipfs-api/src/request/file.rs | 5 +---- ipfs-api/src/request/files.rs | 45 ++++++++------------------------------- ipfs-api/src/request/filestore.rs | 15 +++---------- ipfs-api/src/request/get.rs | 5 +---- ipfs-api/src/request/id.rs | 5 +---- ipfs-api/src/request/key.rs | 10 ++------- ipfs-api/src/request/log.rs | 15 +++---------- ipfs-api/src/request/ls.rs | 5 +---- ipfs-api/src/request/mod.rs | 2 +- ipfs-api/src/request/object.rs | 20 ++++------------- ipfs-api/src/request/pin.rs | 15 +++---------- ipfs-api/src/request/ping.rs | 5 +---- ipfs-api/src/request/pubsub.rs | 20 ++++------------- ipfs-api/src/request/refs.rs | 5 +---- ipfs-api/src/request/stats.rs | 15 +++---------- ipfs-api/src/request/swarm.rs | 10 ++------- ipfs-api/src/request/tar.rs | 10 ++------- ipfs-api/src/request/version.rs | 5 +---- 30 files changed, 73 insertions(+), 286 deletions(-) diff --git a/ipfs-api/src/client.rs b/ipfs-api/src/client.rs index 24a78b3..4d6ceab 100644 --- a/ipfs-api/src/client.rs +++ b/ipfs-api/src/client.rs @@ -84,7 +84,7 @@ impl IpfsClient { let url = format!( "{}{}?{}", self.base, - Req::path(), + Req::path, ::serde_urlencoded::to_string(req)? ); diff --git a/ipfs-api/src/request/add.rs b/ipfs-api/src/request/add.rs index 5f03db5..cc4019c 100644 --- a/ipfs-api/src/request/add.rs +++ b/ipfs-api/src/request/add.rs @@ -14,8 +14,5 @@ pub struct Add; impl_skip_serialize!(Add); impl ApiRequest for Add { - #[inline] - fn path() -> &'static str { - "/add" - } + const path: &'static str = "/add"; } diff --git a/ipfs-api/src/request/bitswap.rs b/ipfs-api/src/request/bitswap.rs index 4ada208..6e711f8 100644 --- a/ipfs-api/src/request/bitswap.rs +++ b/ipfs-api/src/request/bitswap.rs @@ -16,10 +16,7 @@ pub struct BitswapLedger<'a> { } impl<'a> ApiRequest for BitswapLedger<'a> { - #[inline] - fn path() -> &'static str { - "/bitswap/ledger" - } + const path: &'static str = "/bitswap/ledger"; } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] @@ -28,10 +25,7 @@ pub struct BitswapStat; impl_skip_serialize!(BitswapStat); impl ApiRequest for BitswapStat { - #[inline] - fn path() -> &'static str { - "/bitswap/stat" - } + const path: &'static str = "/bitswap/stat"; } @@ -42,10 +36,7 @@ pub struct BitswapUnwant<'a> { } impl<'a> ApiRequest for BitswapUnwant<'a> { - #[inline] - fn path() -> &'static str { - "/bitswap/stat" - } + const path: &'static str = "/bitswap/stat"; } @@ -55,8 +46,5 @@ pub struct BitswapWantlist<'a> { } impl<'a> ApiRequest for BitswapWantlist<'a> { - #[inline] - fn path() -> &'static str { - "/bitswap/wantlist" - } + const path: &'static str = "/bitswap/wantlist"; } diff --git a/ipfs-api/src/request/block.rs b/ipfs-api/src/request/block.rs index 02583fe..799f2f4 100644 --- a/ipfs-api/src/request/block.rs +++ b/ipfs-api/src/request/block.rs @@ -16,10 +16,7 @@ pub struct BlockGet<'a> { } impl<'a> ApiRequest for BlockGet<'a> { - #[inline] - fn path() -> &'static str { - "/block/get" - } + const path: &'static str = "/block/get"; } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] @@ -28,10 +25,7 @@ pub struct BlockPut; impl_skip_serialize!(BlockPut); impl ApiRequest for BlockPut { - #[inline] - fn path() -> &'static str { - "/block/put" - } + const path: &'static str = "/block/put"; } @@ -42,10 +36,7 @@ pub struct BlockRm<'a> { } impl<'a> ApiRequest for BlockRm<'a> { - #[inline] - fn path() -> &'static str { - "/block/rm" - } + const path: &'static str = "/block/rm"; } @@ -56,8 +47,5 @@ pub struct BlockStat<'a> { } impl<'a> ApiRequest for BlockStat<'a> { - #[inline] - fn path() -> &'static str { - "/block/stat" - } + const path: &'static str = "/block/stat"; } diff --git a/ipfs-api/src/request/bootstrap.rs b/ipfs-api/src/request/bootstrap.rs index adbfd19..9ffd482 100644 --- a/ipfs-api/src/request/bootstrap.rs +++ b/ipfs-api/src/request/bootstrap.rs @@ -14,10 +14,7 @@ pub struct BootstrapAddDefault; impl_skip_serialize!(BootstrapAddDefault); impl ApiRequest for BootstrapAddDefault { - #[inline] - fn path() -> &'static str { - "/bootstrap/add/default" - } + const path: &'static str = "/bootstrap/add/default"; } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] @@ -26,10 +23,7 @@ pub struct BootstrapList; impl_skip_serialize!(BootstrapList); impl ApiRequest for BootstrapList { - #[inline] - fn path() -> &'static str { - "/bootstrap/list" - } + const path: &'static str = "/bootstrap/list"; } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] @@ -38,8 +32,5 @@ pub struct BootstrapRmAll; impl_skip_serialize!(BootstrapRmAll); impl ApiRequest for BootstrapRmAll { - #[inline] - fn path() -> &'static str { - "/bootstrap/rm/all" - } + const path: &'static str = "/bootstrap/rm/all"; } diff --git a/ipfs-api/src/request/cat.rs b/ipfs-api/src/request/cat.rs index d14a6e8..5bae654 100644 --- a/ipfs-api/src/request/cat.rs +++ b/ipfs-api/src/request/cat.rs @@ -16,8 +16,5 @@ pub struct Cat<'a> { } impl<'a> ApiRequest for Cat<'a> { - #[inline] - fn path() -> &'static str { - "/cat" - } + const path: &'static str = "/cat"; } diff --git a/ipfs-api/src/request/commands.rs b/ipfs-api/src/request/commands.rs index 609a2cd..8efb683 100644 --- a/ipfs-api/src/request/commands.rs +++ b/ipfs-api/src/request/commands.rs @@ -14,8 +14,5 @@ pub struct Commands; impl_skip_serialize!(Commands); impl ApiRequest for Commands { - #[inline] - fn path() -> &'static str { - "/commands" - } + const path: &'static str = "/commands"; } diff --git a/ipfs-api/src/request/config.rs b/ipfs-api/src/request/config.rs index b70d981..600db3a 100644 --- a/ipfs-api/src/request/config.rs +++ b/ipfs-api/src/request/config.rs @@ -14,10 +14,7 @@ pub struct ConfigEdit; impl_skip_serialize!(ConfigEdit); impl ApiRequest for ConfigEdit { - #[inline] - fn path() -> &'static str { - "/config/edit" - } + const path: &'static str = "/config/edit"; } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] @@ -26,10 +23,7 @@ pub struct ConfigReplace; impl_skip_serialize!(ConfigReplace); impl ApiRequest for ConfigReplace { - #[inline] - fn path() -> &'static str { - "/config/replace" - } + const path: &'static str = "/config/replace"; } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] @@ -38,8 +32,5 @@ pub struct ConfigShow; impl_skip_serialize!(ConfigShow); impl ApiRequest for ConfigShow { - #[inline] - fn path() -> &'static str { - "/config/show" - } + const path: &'static str = "/config/show"; } diff --git a/ipfs-api/src/request/dag.rs b/ipfs-api/src/request/dag.rs index a3a64a9..b2d03ff 100644 --- a/ipfs-api/src/request/dag.rs +++ b/ipfs-api/src/request/dag.rs @@ -16,10 +16,7 @@ pub struct DagGet<'a> { } impl<'a> ApiRequest for DagGet<'a> { - #[inline] - fn path() -> &'static str { - "/dag/get" - } + const path: &'static str = "/dag/get"; } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] @@ -28,8 +25,5 @@ pub struct DagPut; impl_skip_serialize!(DagPut); impl ApiRequest for DagPut { - #[inline] - fn path() -> &'static str { - "/dag/put" - } + const path: &'static str = "/dag/put"; } diff --git a/ipfs-api/src/request/dht.rs b/ipfs-api/src/request/dht.rs index 9677215..ec3239a 100644 --- a/ipfs-api/src/request/dht.rs +++ b/ipfs-api/src/request/dht.rs @@ -16,10 +16,7 @@ pub struct DhtFindPeer<'a> { } impl<'a> ApiRequest for DhtFindPeer<'a> { - #[inline] - fn path() -> &'static str { - "/dht/findpeer" - } + const path: &'static str = "/dht/findpeer"; } @@ -30,10 +27,7 @@ pub struct DhtFindProvs<'a> { } impl<'a> ApiRequest for DhtFindProvs<'a> { - #[inline] - fn path() -> &'static str { - "/dht/findprovs" - } + const path: &'static str = "/dht/findprovs"; } @@ -44,10 +38,7 @@ pub struct DhtGet<'a> { } impl<'a> ApiRequest for DhtGet<'a> { - #[inline] - fn path() -> &'static str { - "/dht/get" - } + const path: &'static str = "/dht/get"; } @@ -58,10 +49,7 @@ pub struct DhtProvide<'a> { } impl<'a> ApiRequest for DhtProvide<'a> { - #[inline] - fn path() -> &'static str { - "/dht/provide" - } + const path: &'static str = "/dht/provide"; } @@ -75,10 +63,7 @@ pub struct DhtPut<'a> { } impl<'a> ApiRequest for DhtPut<'a> { - #[inline] - fn path() -> &'static str { - "/dht/put" - } + const path: &'static str = "/dht/put"; } @@ -89,8 +74,5 @@ pub struct DhtQuery<'a> { } impl<'a> ApiRequest for DhtQuery<'a> { - #[inline] - fn path() -> &'static str { - "/dht/query" - } + const path: &'static str = "/dht/query"; } diff --git a/ipfs-api/src/request/diag.rs b/ipfs-api/src/request/diag.rs index 2045e83..1ccbdf1 100644 --- a/ipfs-api/src/request/diag.rs +++ b/ipfs-api/src/request/diag.rs @@ -14,10 +14,7 @@ pub struct DiagCmdsClear; impl_skip_serialize!(DiagCmdsClear); impl ApiRequest for DiagCmdsClear { - #[inline] - fn path() -> &'static str { - "/diag/cmds/clear" - } + const path: &'static str = "/diag/cmds/clear"; } @@ -28,10 +25,7 @@ pub struct DiagCmdsSetTime<'a> { } impl<'a> ApiRequest for DiagCmdsSetTime<'a> { - #[inline] - fn path() -> &'static str { - "/diag/cmds/set-time" - } + const path: &'static str = "/diag/cmds/set-time"; } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] @@ -40,8 +34,5 @@ pub struct DiagSys; impl_skip_serialize!(DiagSys); impl ApiRequest for DiagSys { - #[inline] - fn path() -> &'static str { - "/diag/sys" - } + const path: &'static str = "/diag/sys"; } diff --git a/ipfs-api/src/request/dns.rs b/ipfs-api/src/request/dns.rs index b9666b3..178bf36 100644 --- a/ipfs-api/src/request/dns.rs +++ b/ipfs-api/src/request/dns.rs @@ -18,8 +18,5 @@ pub struct Dns<'a> { } impl<'a> ApiRequest for Dns<'a> { - #[inline] - fn path() -> &'static str { - "/dns" - } + const path: &'static str = "/dns"; } diff --git a/ipfs-api/src/request/file.rs b/ipfs-api/src/request/file.rs index b0c0bc2..8febb51 100644 --- a/ipfs-api/src/request/file.rs +++ b/ipfs-api/src/request/file.rs @@ -16,8 +16,5 @@ pub struct FileLs<'a> { } impl<'a> ApiRequest for FileLs<'a> { - #[inline] - fn path() -> &'static str { - "/file/ls" - } + const path: &'static str = "/file/ls"; } diff --git a/ipfs-api/src/request/files.rs b/ipfs-api/src/request/files.rs index a986ebe..67f976d 100644 --- a/ipfs-api/src/request/files.rs +++ b/ipfs-api/src/request/files.rs @@ -19,10 +19,7 @@ pub struct FilesCp<'a> { } impl<'a> ApiRequest for FilesCp<'a> { - #[inline] - fn path() -> &'static str { - "/files/cp" - } + const path: &'static str = "/files/cp"; } @@ -33,10 +30,7 @@ pub struct FilesFlush<'a> { } impl<'a> ApiRequest for FilesFlush<'a> { - #[inline] - fn path() -> &'static str { - "/files/flush" - } + const path: &'static str = "/files/flush"; } @@ -47,10 +41,7 @@ pub struct FilesLs<'a> { } impl<'a> ApiRequest for FilesLs<'a> { - #[inline] - fn path() -> &'static str { - "/files/ls" - } + const path: &'static str = "/files/ls"; } @@ -63,10 +54,7 @@ pub struct FilesMkdir<'a> { } impl<'a> ApiRequest for FilesMkdir<'a> { - #[inline] - fn path() -> &'static str { - "/files/mkdir" - } + const path: &'static str = "/files/mkdir"; } @@ -80,10 +68,7 @@ pub struct FilesMv<'a> { } impl<'a> ApiRequest for FilesMv<'a> { - #[inline] - fn path() -> &'static str { - "/files/mv" - } + const path: &'static str = "/files/mv"; } @@ -94,10 +79,7 @@ pub struct FilesRead<'a> { } impl<'a> ApiRequest for FilesRead<'a> { - #[inline] - fn path() -> &'static str { - "/files/read" - } + const path: &'static str = "/files/read"; } @@ -110,10 +92,7 @@ pub struct FilesRm<'a> { } impl<'a> ApiRequest for FilesRm<'a> { - #[inline] - fn path() -> &'static str { - "/files/rm" - } + const path: &'static str = "/files/rm"; } @@ -124,10 +103,7 @@ pub struct FilesStat<'a> { } impl<'a> ApiRequest for FilesStat<'a> { - #[inline] - fn path() -> &'static str { - "/files/stat" - } + const path: &'static str = "/files/stat"; } @@ -142,8 +118,5 @@ pub struct FilesWrite<'a> { } impl<'a> ApiRequest for FilesWrite<'a> { - #[inline] - fn path() -> &'static str { - "/files/write" - } + const path: &'static str = "/files/write"; } diff --git a/ipfs-api/src/request/filestore.rs b/ipfs-api/src/request/filestore.rs index 4ad57e0..2d9047b 100644 --- a/ipfs-api/src/request/filestore.rs +++ b/ipfs-api/src/request/filestore.rs @@ -14,10 +14,7 @@ pub struct FilestoreDups; impl_skip_serialize!(FilestoreDups); impl ApiRequest for FilestoreDups { - #[inline] - fn path() -> &'static str { - "/filestore/dups" - } + const path: &'static str = "/filestore/dups"; } @@ -28,10 +25,7 @@ pub struct FilestoreLs<'a> { } impl<'a> ApiRequest for FilestoreLs<'a> { - #[inline] - fn path() -> &'static str { - "/filestore/ls" - } + const path: &'static str = "/filestore/ls"; } @@ -42,8 +36,5 @@ pub struct FilestoreVerify<'a> { } impl<'a> ApiRequest for FilestoreVerify<'a> { - #[inline] - fn path() -> &'static str { - "/filestore/verify" - } + const path: &'static str = "/filestore/verify"; } diff --git a/ipfs-api/src/request/get.rs b/ipfs-api/src/request/get.rs index 87a414f..1f5e2e0 100644 --- a/ipfs-api/src/request/get.rs +++ b/ipfs-api/src/request/get.rs @@ -16,8 +16,5 @@ pub struct Get<'a> { } impl<'a> ApiRequest for Get<'a> { - #[inline] - fn path() -> &'static str { - "/get" - } + const path: &'static str = "/get"; } diff --git a/ipfs-api/src/request/id.rs b/ipfs-api/src/request/id.rs index 8b4ed39..9648787 100644 --- a/ipfs-api/src/request/id.rs +++ b/ipfs-api/src/request/id.rs @@ -16,8 +16,5 @@ pub struct Id<'a> { } impl<'a> ApiRequest for Id<'a> { - #[inline] - fn path() -> &'static str { - "/id" - } + const path: &'static str = "/id"; } diff --git a/ipfs-api/src/request/key.rs b/ipfs-api/src/request/key.rs index fa27e11..821fd0a 100644 --- a/ipfs-api/src/request/key.rs +++ b/ipfs-api/src/request/key.rs @@ -43,10 +43,7 @@ pub struct KeyGen<'a, 'b> { } impl<'a, 'b> ApiRequest for KeyGen<'a, 'b> { - #[inline] - fn path() -> &'static str { - "/key/gen" - } + const path: &'static str = "/key/gen"; } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] @@ -55,8 +52,5 @@ pub struct KeyList; impl_skip_serialize!(KeyList); impl ApiRequest for KeyList { - #[inline] - fn path() -> &'static str { - "/key/list" - } + const path: &'static str = "/key/list"; } diff --git a/ipfs-api/src/request/log.rs b/ipfs-api/src/request/log.rs index 5f22a40..ed90ec8 100644 --- a/ipfs-api/src/request/log.rs +++ b/ipfs-api/src/request/log.rs @@ -68,10 +68,7 @@ pub struct LogLevel<'a> { } impl<'a> ApiRequest for LogLevel<'a> { - #[inline] - fn path() -> &'static str { - "/log/level" - } + const path: &'static str = "/log/level"; } @@ -81,10 +78,7 @@ pub struct LogLs; impl_skip_serialize!(LogLs); impl ApiRequest for LogLs { - #[inline] - fn path() -> &'static str { - "/log/ls" - } + const path: &'static str = "/log/ls"; } @@ -94,8 +88,5 @@ pub struct LogTail; impl_skip_serialize!(LogTail); impl ApiRequest for LogTail { - #[inline] - fn path() -> &'static str { - "/log/tail" - } + const path: &'static str = "/log/tail"; } diff --git a/ipfs-api/src/request/ls.rs b/ipfs-api/src/request/ls.rs index a6c66ba..54bce37 100644 --- a/ipfs-api/src/request/ls.rs +++ b/ipfs-api/src/request/ls.rs @@ -16,10 +16,7 @@ pub struct Ls<'a> { } impl<'a> ApiRequest for Ls<'a> { - #[inline] - fn path() -> &'static str { - "/ls" - } + const path: &'static str = "/ls"; } diff --git a/ipfs-api/src/request/mod.rs b/ipfs-api/src/request/mod.rs index cbee846..4030047 100644 --- a/ipfs-api/src/request/mod.rs +++ b/ipfs-api/src/request/mod.rs @@ -107,5 +107,5 @@ pub trait ApiRequest { /// /// All paths should begin with '/'. /// - fn path() -> &'static str; + const path: &'static str; } diff --git a/ipfs-api/src/request/object.rs b/ipfs-api/src/request/object.rs index 97bdfad..616a9aa 100644 --- a/ipfs-api/src/request/object.rs +++ b/ipfs-api/src/request/object.rs @@ -19,10 +19,7 @@ pub struct ObjectDiff<'a> { } impl<'a> ApiRequest for ObjectDiff<'a> { - #[inline] - fn path() -> &'static str { - "/object/diff" - } + const path: &'static str = "/object/diff"; } @@ -33,10 +30,7 @@ pub struct ObjectGet<'a> { } impl<'a> ApiRequest for ObjectGet<'a> { - #[inline] - fn path() -> &'static str { - "/object/get" - } + const path: &'static str = "/object/get"; } @@ -47,10 +41,7 @@ pub struct ObjectLinks<'a> { } impl<'a> ApiRequest for ObjectLinks<'a> { - #[inline] - fn path() -> &'static str { - "/object/links" - } + const path: &'static str = "/object/links"; } @@ -61,10 +52,7 @@ pub struct ObjectStat<'a> { } impl<'a> ApiRequest for ObjectStat<'a> { - #[inline] - fn path() -> &'static str { - "/object/stat" - } + const path: &'static str = "/object/stat"; } diff --git a/ipfs-api/src/request/pin.rs b/ipfs-api/src/request/pin.rs index 0d06bbe..f9ac6ef 100644 --- a/ipfs-api/src/request/pin.rs +++ b/ipfs-api/src/request/pin.rs @@ -18,10 +18,7 @@ pub struct PinAdd<'a> { } impl<'a> ApiRequest for PinAdd<'a> { - #[inline] - fn path() -> &'static str { - "/pin/add" - } + const path: &'static str = "/pin/add"; } @@ -35,10 +32,7 @@ pub struct PinLs<'a> { } impl<'a> ApiRequest for PinLs<'a> { - #[inline] - fn path() -> &'static str { - "/pin/ls" - } + const path: &'static str = "/pin/ls"; } @@ -51,8 +45,5 @@ pub struct PinRm<'a> { } impl<'a> ApiRequest for PinRm<'a> { - #[inline] - fn path() -> &'static str { - "/pin/rm" - } + const path: &'static str = "/pin/rm"; } diff --git a/ipfs-api/src/request/ping.rs b/ipfs-api/src/request/ping.rs index 601a463..201b3cd 100644 --- a/ipfs-api/src/request/ping.rs +++ b/ipfs-api/src/request/ping.rs @@ -17,8 +17,5 @@ pub struct Ping<'a, 'b> { } impl<'a, 'b> ApiRequest for Ping<'a, 'b> { - #[inline] - fn path() -> &'static str { - "/ping" - } + const path: &'static str = "/ping"; } diff --git a/ipfs-api/src/request/pubsub.rs b/ipfs-api/src/request/pubsub.rs index d089c2a..fbf5c33 100644 --- a/ipfs-api/src/request/pubsub.rs +++ b/ipfs-api/src/request/pubsub.rs @@ -14,10 +14,7 @@ pub struct PubsubLs; impl_skip_serialize!(PubsubLs); impl ApiRequest for PubsubLs { - #[inline] - fn path() -> &'static str { - "/pubsub/ls" - } + const path: &'static str = "/pubsub/ls"; } @@ -28,10 +25,7 @@ pub struct PubsubPeers<'a> { } impl<'a> ApiRequest for PubsubPeers<'a> { - #[inline] - fn path() -> &'static str { - "/pubsub/peers" - } + const path: &'static str = "/pubsub/peers"; } @@ -45,10 +39,7 @@ pub struct PubsubPub<'a> { } impl<'a> ApiRequest for PubsubPub<'a> { - #[inline] - fn path() -> &'static str { - "/pubsub/pub" - } + const path: &'static str = "/pubsub/pub"; } @@ -61,8 +52,5 @@ pub struct PubsubSub<'a> { } impl<'a> ApiRequest for PubsubSub<'a> { - #[inline] - fn path() -> &'static str { - "/pubsub/sub" - } + const path: &'static str = "/pubsub/sub"; } diff --git a/ipfs-api/src/request/refs.rs b/ipfs-api/src/request/refs.rs index c0df0f8..4fa8710 100644 --- a/ipfs-api/src/request/refs.rs +++ b/ipfs-api/src/request/refs.rs @@ -14,8 +14,5 @@ pub struct RefsLocal; impl_skip_serialize!(RefsLocal); impl ApiRequest for RefsLocal { - #[inline] - fn path() -> &'static str { - "/refs/local" - } + const path: &'static str = "/refs/local"; } diff --git a/ipfs-api/src/request/stats.rs b/ipfs-api/src/request/stats.rs index 1caa257..603115c 100644 --- a/ipfs-api/src/request/stats.rs +++ b/ipfs-api/src/request/stats.rs @@ -14,10 +14,7 @@ pub struct StatsBitswap; impl_skip_serialize!(StatsBitswap); impl ApiRequest for StatsBitswap { - #[inline] - fn path() -> &'static str { - "/stats/bitswap" - } + const path: &'static str = "/stats/bitswap"; } #[derive(Deserialize, Debug, Copy, Clone, PartialEq, Eq, Hash)] @@ -26,10 +23,7 @@ pub struct StatsBw; impl_skip_serialize!(StatsBw); impl ApiRequest for StatsBw { - #[inline] - fn path() -> &'static str { - "/stats/bw" - } + const path: &'static str = "/stats/bw"; } #[derive(Deserialize, Debug, Copy, Clone, PartialEq, Eq, Hash)] @@ -38,8 +32,5 @@ pub struct StatsRepo; impl_skip_serialize!(StatsRepo); impl ApiRequest for StatsRepo { - #[inline] - fn path() -> &'static str { - "/stats/repo" - } + const path: &'static str = "/stats/repo"; } diff --git a/ipfs-api/src/request/swarm.rs b/ipfs-api/src/request/swarm.rs index f1988be..975282d 100644 --- a/ipfs-api/src/request/swarm.rs +++ b/ipfs-api/src/request/swarm.rs @@ -14,10 +14,7 @@ pub struct SwarmAddrsLocal; impl_skip_serialize!(SwarmAddrsLocal); impl ApiRequest for SwarmAddrsLocal { - #[inline] - fn path() -> &'static str { - "/swarm/addrs/local" - } + const path: &'static str = "/swarm/addrs/local"; } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -26,8 +23,5 @@ pub struct SwarmPeers; impl_skip_serialize!(SwarmPeers); impl ApiRequest for SwarmPeers { - #[inline] - fn path() -> &'static str { - "/swarm/peers" - } + const path: &'static str = "/swarm/peers"; } diff --git a/ipfs-api/src/request/tar.rs b/ipfs-api/src/request/tar.rs index 33d5004..d582f12 100644 --- a/ipfs-api/src/request/tar.rs +++ b/ipfs-api/src/request/tar.rs @@ -14,10 +14,7 @@ pub struct TarAdd; impl_skip_serialize!(TarAdd); impl ApiRequest for TarAdd { - #[inline] - fn path() -> &'static str { - "/tar/add" - } + const path: &'static str = "/tar/add"; } @@ -28,8 +25,5 @@ pub struct TarCat<'a> { } impl<'a> ApiRequest for TarCat<'a> { - #[inline] - fn path() -> &'static str { - "/tar/cat" - } + const path: &'static str = "/tar/cat"; } diff --git a/ipfs-api/src/request/version.rs b/ipfs-api/src/request/version.rs index dc7081c..2c02209 100644 --- a/ipfs-api/src/request/version.rs +++ b/ipfs-api/src/request/version.rs @@ -14,8 +14,5 @@ pub struct Version; impl_skip_serialize!(Version); impl ApiRequest for Version { - #[inline] - fn path() -> &'static str { - "/version" - } + const path: &'static str = "/version"; } -- cgit v1.2.3