Skip to content

Commit

Permalink
Add #[inline] on DummyRecordStore to make sure the compiler optim…
Browse files Browse the repository at this point in the history
…izes away as much code as possible
  • Loading branch information
nazar-pc committed Feb 7, 2025
1 parent 9e62d47 commit f24c0a7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/subspace-networking/src/constructor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,40 +122,48 @@ impl RecordStore for DummyRecordStore {
where
Self: 'a;

#[inline]
fn get(&self, _key: &RecordKey) -> Option<Cow<'_, Record>> {
// Not supported
None
}

#[inline]
fn put(&mut self, _record: Record) -> store::Result<()> {
// Not supported
Ok(())
}

#[inline]
fn remove(&mut self, _key: &RecordKey) {
// Not supported
}

#[inline]
fn records(&self) -> Self::RecordsIter<'_> {
// Not supported
iter::empty()
}

#[inline]
fn add_provider(&mut self, _record: ProviderRecord) -> store::Result<()> {
// Not supported
Ok(())
}

#[inline]
fn providers(&self, _key: &RecordKey) -> Vec<ProviderRecord> {
// Not supported
Vec::new()
}

#[inline]
fn provided(&self) -> Self::ProvidedIter<'_> {
// Not supported
iter::empty()
}

#[inline]
fn remove_provider(&mut self, _key: &RecordKey, _provider: &PeerId) {
// Not supported
}
Expand Down

0 comments on commit f24c0a7

Please sign in to comment.