mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
More inlining
This commit is contained in:
parent
29b81a3d50
commit
de9b2998ac
4 changed files with 12 additions and 0 deletions
|
@ -383,6 +383,7 @@ cfg_if! {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl NonViewMarkerSibling for web_sys::Node {
|
impl NonViewMarkerSibling for web_sys::Node {
|
||||||
|
#[cfg_attr(not(debug_assertions), inline(always))]
|
||||||
fn next_non_view_marker_sibling(&self) -> Option<Node> {
|
fn next_non_view_marker_sibling(&self) -> Option<Node> {
|
||||||
cfg_if! {
|
cfg_if! {
|
||||||
if #[cfg(debug_assertions)] {
|
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> {
|
fn previous_non_view_marker_sibling(&self) -> Option<Node> {
|
||||||
cfg_if! {
|
cfg_if! {
|
||||||
if #[cfg(debug_assertions)] {
|
if #[cfg(debug_assertions)] {
|
||||||
|
|
|
@ -155,6 +155,7 @@ impl Mountable for EachRepr {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
fn get_closing_node(&self) -> web_sys::Node {
|
fn get_closing_node(&self) -> web_sys::Node {
|
||||||
self.closing.node.clone()
|
self.closing.node.clone()
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,6 +137,7 @@ impl<T> IntoView for (Scope, T)
|
||||||
where
|
where
|
||||||
T: IntoView,
|
T: IntoView,
|
||||||
{
|
{
|
||||||
|
#[inline(always)]
|
||||||
fn into_view(self, _: Scope) -> View {
|
fn into_view(self, _: Scope) -> View {
|
||||||
self.1.into_view(self.0)
|
self.1.into_view(self.0)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,30 +7,36 @@ use thiserror::Error;
|
||||||
// that O(n) iteration over a vectorized map is (*probably*) more space-
|
// that O(n) iteration over a vectorized map is (*probably*) more space-
|
||||||
// and time-efficient than hashing and using an actual `HashMap`
|
// and time-efficient than hashing and using an actual `HashMap`
|
||||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||||
|
#[repr(transparent)]
|
||||||
pub struct ParamsMap(pub LinearMap<String, String>);
|
pub struct ParamsMap(pub LinearMap<String, String>);
|
||||||
|
|
||||||
impl ParamsMap {
|
impl ParamsMap {
|
||||||
/// Creates an empty map.
|
/// Creates an empty map.
|
||||||
|
#[inline(always)]
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self(LinearMap::new())
|
Self(LinearMap::new())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates an empty map with the given capacity.
|
/// Creates an empty map with the given capacity.
|
||||||
|
#[inline(always)]
|
||||||
pub fn with_capacity(capacity: usize) -> Self {
|
pub fn with_capacity(capacity: usize) -> Self {
|
||||||
Self(LinearMap::with_capacity(capacity))
|
Self(LinearMap::with_capacity(capacity))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Inserts a value into the map.
|
/// Inserts a value into the map.
|
||||||
|
#[inline(always)]
|
||||||
pub fn insert(&mut self, key: String, value: String) -> Option<String> {
|
pub fn insert(&mut self, key: String, value: String) -> Option<String> {
|
||||||
self.0.insert(key, value)
|
self.0.insert(key, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets a value from the map.
|
/// Gets a value from the map.
|
||||||
|
#[inline(always)]
|
||||||
pub fn get(&self, key: &str) -> Option<&String> {
|
pub fn get(&self, key: &str) -> Option<&String> {
|
||||||
self.0.get(key)
|
self.0.get(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Removes a value from the map.
|
/// Removes a value from the map.
|
||||||
|
#[inline(always)]
|
||||||
pub fn remove(&mut self, key: &str) -> Option<String> {
|
pub fn remove(&mut self, key: &str) -> Option<String> {
|
||||||
self.0.remove(key)
|
self.0.remove(key)
|
||||||
}
|
}
|
||||||
|
@ -51,6 +57,7 @@ impl ParamsMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ParamsMap {
|
impl Default for ParamsMap {
|
||||||
|
#[inline(always)]
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::new()
|
Self::new()
|
||||||
}
|
}
|
||||||
|
@ -95,6 +102,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Params for () {
|
impl Params for () {
|
||||||
|
#[inline(always)]
|
||||||
fn from_map(_map: &ParamsMap) -> Result<Self, ParamsError> {
|
fn from_map(_map: &ParamsMap) -> Result<Self, ParamsError> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue