-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make lower_level_interface generic #495
Comments
Hi @Syther007, I don't want to load you up with more work to do but could you please elaborate on what specifically you had in mind when making this card out? Some real-like piece of code or just a pseudo-one would be handy. Do you remember details of your idea? I can suppose what you might've meant. However, I'm not convinced we would benefit much from the new feature in the Rust language you refer to. I cannot imagine why it'd be useful to have the associated types defaulted. I think it is completely fine if each implementor of this trait will define its own types, because if you said this wouldn't be necessary, then the need to make the data structures generic would not sound true in first place. I don't know all the caveats of this but I'm reasoning like this because it is quite a unique requirement having a default. |
This is how associated types looks in action. pub trait LowBlockchainInt {
// TODO: GH-495 The data structures in this trait are not generic, will need associated_type_defaults to implement it.
// see issue #29661 <https://github.com/rust-lang/rust/issues/29661> for more information
type BigNumber;
type Number;
type Hash;
type TxFilter;
type TxReceipt;
type WalletAddress;
fn get_transaction_fee_balance(
&self,
address: WalletAddress,
) -> Box<dyn Future<Item = BigNumber, Error = BlockchainError>>;
fn get_service_fee_balance(
&self,
address: WalletAddress,
) -> Box<dyn Future<Item = BigNumber, Error = BlockchainError>>;
fn get_gas_price(&self) -> Box<dyn Future<Item = BigNumber, Error = BlockchainError>>;
fn get_block_number(&self) -> Box<dyn Future<Item = Number, Error = BlockchainError>>;
fn get_transaction_id(
&self,
address: WalletAddress,
) -> Box<dyn Future<Item = BigNumber, Error = BlockchainError>>;
fn get_transaction_receipt_in_batch(
&self,
hash_vec: Vec<Hash>,
) -> Box<dyn Future<Item = Vec<TransactionReceiptResult>, Error = BlockchainError>>;
fn get_contract(&self) -> Contract<Http>;
fn get_transaction_logs(
&self,
filter: TxFilter,
) -> Box<dyn Future<Item = Vec<TxReceipt>, Error = BlockchainError>>;
fn submit_payables_in_batch(
&self,
logger: Logger,
chain: Chain,
consuming_wallet: Wallet,
fingerprints_recipient: Recipient<PendingPayableFingerprintSeeds>,
affordable_accounts: Vec<PayableAccount>,
) -> Box<dyn Future<Item = Vec<ProcessedPayableFallible>, Error = PayableTransactionError>>;
} |
The data structures in this trait are not generic, will need associated_type_defaults to implement it.
see issue #29661 rust-lang/rust#29661 for more information
The text was updated successfully, but these errors were encountered: