More inlining

This commit is contained in:
novacrazy 2023-04-07 05:09:24 -05:00
parent 29b81a3d50
commit de9b2998ac
4 changed files with 12 additions and 0 deletions

View file

@ -383,6 +383,7 @@ cfg_if! {
}
impl NonViewMarkerSibling for web_sys::Node {
#[cfg_attr(not(debug_assertions), inline(always))]
fn next_non_view_marker_sibling(&self) -> Option<Node> {
cfg_if! {
if #[cfg(debug_assertions)] {
@ -399,6 +400,7 @@ cfg_if! {
}
}
#[cfg_attr(not(debug_assertions), inline(always))]
fn previous_non_view_marker_sibling(&self) -> Option<Node> {
cfg_if! {
if #[cfg(debug_assertions)] {

View file

@ -155,6 +155,7 @@ impl Mountable for EachRepr {
};
}
#[inline(always)]
fn get_closing_node(&self) -> web_sys::Node {
self.closing.node.clone()
}

View file

@ -137,6 +137,7 @@ impl<T> IntoView for (Scope, T)
where
T: IntoView,
{
#[inline(always)]
fn into_view(self, _: Scope) -> View {
self.1.into_view(self.0)
}

View file

@ -7,30 +7,36 @@ use thiserror::Error;
// that O(n) iteration over a vectorized map is (*probably*) more space-
// and time-efficient than hashing and using an actual `HashMap`
#[derive(Debug, PartialEq, Eq, Clone)]
#[repr(transparent)]
pub struct ParamsMap(pub LinearMap<String, String>);
impl ParamsMap {
/// Creates an empty map.
#[inline(always)]
pub fn new() -> Self {
Self(LinearMap::new())
}
/// Creates an empty map with the given capacity.
#[inline(always)]
pub fn with_capacity(capacity: usize) -> Self {
Self(LinearMap::with_capacity(capacity))
}
/// Inserts a value into the map.
#[inline(always)]
pub fn insert(&mut self, key: String, value: String) -> Option<String> {
self.0.insert(key, value)
}
/// Gets a value from the map.
#[inline(always)]
pub fn get(&self, key: &str) -> Option<&String> {
self.0.get(key)
}
/// Removes a value from the map.
#[inline(always)]
pub fn remove(&mut self, key: &str) -> Option<String> {
self.0.remove(key)
}
@ -51,6 +57,7 @@ impl ParamsMap {
}
impl Default for ParamsMap {
#[inline(always)]
fn default() -> Self {
Self::new()
}
@ -95,6 +102,7 @@ where
}
impl Params for () {
#[inline(always)]
fn from_map(_map: &ParamsMap) -> Result<Self, ParamsError> {
Ok(())
}