SkyblockRepo

Struct SkyblockRepo 

Source
pub struct SkyblockRepo {
    pub enchantments: FxHashMap<String, SkyblockEnchantment>,
    pub items: FxHashMap<String, SkyblockItem>,
    pub npcs: FxHashMap<String, SkyblockNpc>,
    pub pets: FxHashMap<String, SkyblockPet>,
    pub shops: FxHashMap<String, SkyblockShop>,
    pub zones: FxHashMap<String, SkyblockZone>,
}
Expand description

each category of items as a mapping of internal_id to its item data

Fields§

§enchantments: FxHashMap<String, SkyblockEnchantment>§items: FxHashMap<String, SkyblockItem>§npcs: FxHashMap<String, SkyblockNpc>§pets: FxHashMap<String, SkyblockPet>§shops: FxHashMap<String, SkyblockShop>§zones: FxHashMap<String, SkyblockZone>

Implementations§

Source§

impl SkyblockRepo

Source

pub fn new() -> Result<Self, Box<dyn Error>>

Examples found in repository?
examples/basic.rs (line 14)
5fn main() {
6	let mut start = Instant::now();
7	download_repo(false, None).unwrap();
8	println!(
9		"Time taken to download and extract repo: {}s",
10		start.elapsed().as_secs_f32()
11	);
12	start = Instant::now();
13
14	let data = SkyblockRepo::new().unwrap();
15	println!(
16		"Time taken to parse repo: {}ms",
17		start.elapsed().as_millis()
18	);
19	start = Instant::now();
20
21	println!("{:?}", data.get_enchantment_by_id("TELEKINESIS"));
22	println!(
23		"Time taken to get data for `TELEKINESIS`: {}µs",
24		(start.elapsed().as_nanos() as f32 / 1_000.0)
25	);
26	start = Instant::now();
27
28	delete_repo().unwrap();
29	println!(
30		"Time taken to delete repo: {}ms",
31		start.elapsed().as_millis()
32	);
33}
Source

pub fn get_enchantment_by_id(&self, id: &str) -> Option<SkyblockEnchantment>

Retrieves a $name by its internalId.

Examples found in repository?
examples/basic.rs (line 21)
5fn main() {
6	let mut start = Instant::now();
7	download_repo(false, None).unwrap();
8	println!(
9		"Time taken to download and extract repo: {}s",
10		start.elapsed().as_secs_f32()
11	);
12	start = Instant::now();
13
14	let data = SkyblockRepo::new().unwrap();
15	println!(
16		"Time taken to parse repo: {}ms",
17		start.elapsed().as_millis()
18	);
19	start = Instant::now();
20
21	println!("{:?}", data.get_enchantment_by_id("TELEKINESIS"));
22	println!(
23		"Time taken to get data for `TELEKINESIS`: {}µs",
24		(start.elapsed().as_nanos() as f32 / 1_000.0)
25	);
26	start = Instant::now();
27
28	delete_repo().unwrap();
29	println!(
30		"Time taken to delete repo: {}ms",
31		start.elapsed().as_millis()
32	);
33}
Source

pub fn get_item_by_id(&self, id: &str) -> Option<SkyblockItem>

Retrieves a $name by its internalId.

Source

pub fn get_pet_by_id(&self, id: &str) -> Option<SkyblockPet>

Retrieves a $name by its internalId.

Source

pub fn get_npc_by_id(&self, id: &str) -> Option<SkyblockNpc>

Retrieves a $name by its internalId.

Source

pub fn get_shop_by_id(&self, id: &str) -> Option<SkyblockShop>

Retrieves a $name by its internalId.

Source

pub fn get_zone_by_id(&self, id: &str) -> Option<SkyblockZone>

Retrieves a $name by its internalId.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.