pub struct RouterBuilder<H: RpcHandler> { /* private fields */ }Expand description
Builder for creating the RPC router.
This builder allows you to selectively enable endpoints for the router,
and a fallback route.
The default is to enable all routes.
§Routes
Functions that enable routes are separated into 3 groups:
json_rpc(enables all of JSON RPC 2.0)other_(e.g.other_get_height)bin_(e.g.bin_get_blocks)
For a list of all monerod routes, see
here,
or the source file of this type.
§Aliases
Some routes have aliases, such as /get_height
and /getheight.
These both route to the same handler function, but they do not enable each other.
If desired, you can enable /get_height but not /getheight.
§Example
use cuprate_rpc_interface::{RouterBuilder, RpcHandlerDummy};
// Create a router with _only_ `/json_rpc` enabled.
let only_json_rpc = RouterBuilder::<RpcHandlerDummy>::new()
.json_rpc()
.build();
// Create a router with:
// - `/get_outs.bin` enabled
// - A fallback enabled
let get_outs_bin_and_fallback = RouterBuilder::<RpcHandlerDummy>::new()
.bin_get_outs()
.fallback()
.build();
// Create a router with all endpoints enabled.
let all = RouterBuilder::<RpcHandlerDummy>::new()
.all()
.build();Implementations§
Source§impl<H: RpcHandler> RouterBuilder<H>
impl<H: RpcHandler> RouterBuilder<H>
Sourcepub fn build(self) -> Router<H>
pub fn build(self) -> Router<H>
All endpoints enabled in RouterBuilder
will be enabled in this Router.
Sourcepub fn all(self) -> Self
pub fn all(self) -> Self
Enable all endpoints, including Self::fallback.
Sourcepub fn fallback(self) -> Self
pub fn fallback(self) -> Self
Enable the catch-all fallback route.
Any unknown or disabled route will route here, e.g.:
get_infogetinfoasdf
Sourcepub fn other_get_height(self) -> Self
pub fn other_get_height(self) -> Self
Enable the /get_height endpoint.
Sourcepub fn other_getheight(self) -> Self
pub fn other_getheight(self) -> Self
Enable the /getheight endpoint.
Sourcepub fn other_get_transactions(self) -> Self
pub fn other_get_transactions(self) -> Self
Enable the /get_transactions endpoint.
Sourcepub fn other_gettransactions(self) -> Self
pub fn other_gettransactions(self) -> Self
Enable the /gettransactions endpoint.
Sourcepub fn other_get_alt_blocks_hashes(self) -> Self
pub fn other_get_alt_blocks_hashes(self) -> Self
Enable the /get_alt_blocks_hashes endpoint.
Sourcepub fn other_is_key_image_spent(self) -> Self
pub fn other_is_key_image_spent(self) -> Self
Enable the /is_key_image_spent endpoint.
Sourcepub fn other_send_raw_transaction(self) -> Self
pub fn other_send_raw_transaction(self) -> Self
Enable the /send_raw_transaction endpoint.
Sourcepub fn other_sendrawtransaction(self) -> Self
pub fn other_sendrawtransaction(self) -> Self
Enable the /sendrawtransaction endpoint.
Sourcepub fn other_start_mining(self) -> Self
pub fn other_start_mining(self) -> Self
Enable the /start_mining endpoint.
Sourcepub fn other_stop_mining(self) -> Self
pub fn other_stop_mining(self) -> Self
Enable the /stop_mining endpoint.
Sourcepub fn other_mining_status(self) -> Self
pub fn other_mining_status(self) -> Self
Enable the /mining_status endpoint.
Sourcepub fn other_save_bc(self) -> Self
pub fn other_save_bc(self) -> Self
Enable the /save_bc endpoint.
Sourcepub fn other_get_peer_list(self) -> Self
pub fn other_get_peer_list(self) -> Self
Enable the /get_peer_list endpoint.
Sourcepub fn other_get_public_nodes(self) -> Self
pub fn other_get_public_nodes(self) -> Self
Enable the /get_public_nodes endpoint.
Sourcepub fn other_set_log_hash_rate(self) -> Self
pub fn other_set_log_hash_rate(self) -> Self
Enable the /set_log_hash_rate endpoint.
Sourcepub fn other_set_log_level(self) -> Self
pub fn other_set_log_level(self) -> Self
Enable the /set_log_level endpoint.
Sourcepub fn other_set_log_categories(self) -> Self
pub fn other_set_log_categories(self) -> Self
Enable the /set_log_categories endpoint.
Sourcepub fn other_get_transaction_pool(self) -> Self
pub fn other_get_transaction_pool(self) -> Self
Enable the /get_transaction_pool endpoint.
Sourcepub fn other_get_transaction_pool_hashes(self) -> Self
pub fn other_get_transaction_pool_hashes(self) -> Self
Enable the /get_transaction_pool_hashes endpoint.
Sourcepub fn other_get_transaction_pool_stats(self) -> Self
pub fn other_get_transaction_pool_stats(self) -> Self
Enable the /get_transaction_pool_stats endpoint.
Sourcepub fn other_set_bootstrap_daemon(self) -> Self
pub fn other_set_bootstrap_daemon(self) -> Self
Enable the /set_bootstrap_daemon endpoint.
Sourcepub fn other_stop_daemon(self) -> Self
pub fn other_stop_daemon(self) -> Self
Enable the /stop_daemon endpoint.
Sourcepub fn other_get_net_stats(self) -> Self
pub fn other_get_net_stats(self) -> Self
Enable the /get_net_stats endpoint.
Sourcepub fn other_get_limit(self) -> Self
pub fn other_get_limit(self) -> Self
Enable the /get_limit endpoint.
Sourcepub fn other_set_limit(self) -> Self
pub fn other_set_limit(self) -> Self
Enable the /set_limit endpoint.
Sourcepub fn other_out_peers(self) -> Self
pub fn other_out_peers(self) -> Self
Enable the /out_peers endpoint.
Sourcepub fn other_in_peers(self) -> Self
pub fn other_in_peers(self) -> Self
Enable the /in_peers endpoint.
Sourcepub fn other_get_outs(self) -> Self
pub fn other_get_outs(self) -> Self
Enable the /get_outs endpoint.
Sourcepub fn other_update(self) -> Self
pub fn other_update(self) -> Self
Enable the /update endpoint.
Sourcepub fn other_pop_blocks(self) -> Self
pub fn other_pop_blocks(self) -> Self
Enable the /pop_blocks endpoint.
Sourcepub fn bin_get_blocks(self) -> Self
pub fn bin_get_blocks(self) -> Self
Enable the /get_blocks.bin endpoint.
Sourcepub fn bin_getblocks(self) -> Self
pub fn bin_getblocks(self) -> Self
Enable the /getblocks.bin endpoint.
Sourcepub fn bin_get_blocks_by_height(self) -> Self
pub fn bin_get_blocks_by_height(self) -> Self
Enable the /get_blocks_by_height.bin endpoint.
Sourcepub fn bin_getblocks_by_height(self) -> Self
pub fn bin_getblocks_by_height(self) -> Self
Enable the /getblocks_by_height.bin endpoint.
Sourcepub fn bin_get_hashes(self) -> Self
pub fn bin_get_hashes(self) -> Self
Enable the /get_hashes.bin endpoint.
Sourcepub fn bin_gethashes(self) -> Self
pub fn bin_gethashes(self) -> Self
Enable the /gethashes.bin endpoint.
Sourcepub fn bin_get_o_indexes(self) -> Self
pub fn bin_get_o_indexes(self) -> Self
Enable the /get_o_indexes.bin endpoint.
Sourcepub fn bin_get_outs(self) -> Self
pub fn bin_get_outs(self) -> Self
Enable the /get_outs.bin endpoint.
Sourcepub fn bin_get_transaction_pool_hashes(self) -> Self
pub fn bin_get_transaction_pool_hashes(self) -> Self
Enable the /get_transaction_pool_hashes.bin endpoint.
Sourcepub fn bin_get_output_distribution(self) -> Self
pub fn bin_get_output_distribution(self) -> Self
Enable the /get_output_distribution.bin endpoint.
Trait Implementations§
Source§impl<H: Clone + RpcHandler> Clone for RouterBuilder<H>
impl<H: Clone + RpcHandler> Clone for RouterBuilder<H>
Source§fn clone(&self) -> RouterBuilder<H>
fn clone(&self) -> RouterBuilder<H>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<H: RpcHandler> Default for RouterBuilder<H>
impl<H: RpcHandler> Default for RouterBuilder<H>
Auto Trait Implementations§
impl<H> Freeze for RouterBuilder<H>
impl<H> !RefUnwindSafe for RouterBuilder<H>
impl<H> Send for RouterBuilder<H>
impl<H> Sync for RouterBuilder<H>
impl<H> Unpin for RouterBuilder<H>
impl<H> !UnwindSafe for RouterBuilder<H>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes