Skip to content

Commit 290a144

Browse files
committed
Remove unused structs and improve docs:
- primitives - add `#[doc(inline)]` - primitives - channel - remove old structs - adview-manager - fix rustdoc warning
1 parent b3ab61c commit 290a144

File tree

6 files changed

+8
-49
lines changed

6 files changed

+8
-49
lines changed

adview-manager/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const IPFS_GATEWAY: &str = "https://ipfs.moonicorn.network/ipfs/";
3636
/// Related: <https://github.com/AdExNetwork/adex-adview-manager/issues/17>, <https://github.com/AdExNetwork/adex-adview-manager/issues/35>, <https://github.com/AdExNetwork/adex-adview-manager/issues/46>
3737
///
3838
/// Used for JS [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout) function
39-
const WAIT_FOR_IMPRESSION: u32 = 8000;
39+
pub const WAIT_FOR_IMPRESSION: u32 = 8000;
4040
// The number of impressions (won auctions) kept in history
4141
const HISTORY_LIMIT: u32 = 50;
4242

primitives/src/campaign.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use chrono::{
1010
use serde::{Deserialize, Serialize};
1111
use serde_with::with_prefix;
1212

13+
#[doc(inline)]
1314
pub use {
1415
campaign_id::CampaignId,
1516
pricing::{Pricing, PricingBounds},

primitives/src/channel.rs

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{error::Error, fmt, ops::Deref, str::FromStr};
1+
use std::{fmt, ops::Deref, str::FromStr};
22

33
use ethereum_types::U256;
44

@@ -7,7 +7,7 @@ use serde_hex::{SerHex, StrictPfx};
77

88
use hex::{FromHex, FromHexError};
99

10-
use crate::{chain::Chain, config::TokenInfo, Address, Validator, ValidatorId};
10+
use crate::{Address, Validator, ValidatorId};
1111

1212
#[derive(Serialize, Deserialize, PartialEq, Eq, Copy, Clone, Hash)]
1313
#[serde(transparent)]
@@ -90,12 +90,6 @@ impl FromStr for ChannelId {
9090
}
9191
}
9292

93-
#[derive(Debug, Clone, PartialEq, Eq)]
94-
pub struct ChainContext {
95-
pub token: TokenInfo,
96-
pub chain: Chain,
97-
}
98-
9993
#[derive(Serialize, Deserialize, Debug, Copy, Clone, PartialEq, Eq, Hash)]
10094
#[serde(rename_all = "camelCase")]
10195
pub struct Channel {
@@ -198,46 +192,6 @@ impl Serialize for Nonce {
198192
}
199193
}
200194

201-
#[derive(Debug, PartialEq, Eq)]
202-
pub enum ChannelError {
203-
InvalidArgument(String),
204-
/// When the Adapter address is not listed in the `channel.spec.validators`
205-
/// which in terms means, that the adapter shouldn't handle this Channel
206-
AdapterNotIncluded,
207-
/// when `channel.valid_until` has passed (< now), the channel should be handled
208-
InvalidValidUntil(String),
209-
UnlistedValidator,
210-
UnlistedCreator,
211-
UnlistedAsset,
212-
MinimumValidatorFeeNotMet,
213-
FeeConstraintViolated,
214-
}
215-
216-
impl fmt::Display for ChannelError {
217-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
218-
match self {
219-
ChannelError::InvalidArgument(error) => write!(f, "{}", error),
220-
ChannelError::AdapterNotIncluded => write!(f, "channel is not validated by us"),
221-
ChannelError::InvalidValidUntil(error) => write!(f, "{}", error),
222-
ChannelError::UnlistedValidator => write!(f, "validators are not in the whitelist"),
223-
ChannelError::UnlistedCreator => write!(f, "channel.creator is not whitelisted"),
224-
ChannelError::UnlistedAsset => write!(f, "channel.depositAsset is not whitelisted"),
225-
ChannelError::MinimumValidatorFeeNotMet => {
226-
write!(f, "channel validator fee is less than MINIMAL_FEE")
227-
}
228-
ChannelError::FeeConstraintViolated => {
229-
write!(f, "total fees <= deposit: fee constraint violated")
230-
}
231-
}
232-
}
233-
}
234-
235-
impl Error for ChannelError {
236-
fn cause(&self) -> Option<&dyn Error> {
237-
None
238-
}
239-
}
240-
241195
#[cfg(test)]
242196
mod test {
243197
use super::*;

primitives/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#![allow(unstable_name_collisions)]
66
use std::{error, fmt};
77

8+
#[doc(inline)]
89
pub use self::{
910
ad_slot::AdSlot,
1011
ad_unit::AdUnit,
@@ -159,6 +160,7 @@ mod deposit {
159160
}
160161

161162
pub mod util {
163+
#[doc(inline)]
162164
pub use api::ApiUrl;
163165

164166
pub mod api;

primitives/src/targeting.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pub use eval::*;
44
use serde_json::Number;
55
use std::collections::HashMap;
66

7+
#[doc(inline)]
78
pub use input::{field::GetField, Input};
89

910
mod eval;

primitives/src/validator.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use crate::{
99
Address, DomainError, ToETHChecksum, ToHex, UnifiedNum,
1010
};
1111

12+
#[doc(inline)]
1213
pub use messages::*;
1314

1415
#[derive(Serialize, Deserialize, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]

0 commit comments

Comments
 (0)