Skip to content

Commit

Permalink
SpecialVTagKind -> VTagKind
Browse files Browse the repository at this point in the history
  • Loading branch information
its-the-shrimp committed Aug 21, 2023
1 parent 31acb30 commit 9949e9f
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions packages/yew/src/html/component/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ mod feat_ssr {
use std::fmt::Write;

use super::*;
use crate::feat_ssr::SpecialVTagKind;
use crate::feat_ssr::VTagKind;
use crate::html::component::lifecycle::{
ComponentRenderState, CreateRunner, DestroyRunner, RenderRunner,
};
Expand All @@ -309,7 +309,7 @@ mod feat_ssr {
w: &mut BufWriter,
props: Rc<COMP::Properties>,
hydratable: bool,
parent_vtag_kind: SpecialVTagKind,
parent_vtag_kind: VTagKind,
) {
// Rust's Future implementation is stack-allocated and incurs zero runtime-cost.
//
Expand Down
4 changes: 2 additions & 2 deletions packages/yew/src/server_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub(crate) mod feat_ssr {
/// Right now this is used to make `VText` nodes aware of their environment and correctly
/// escape their contents when rendering them during SSR.
#[derive(Default, Clone, Copy)]
pub(crate) enum SpecialVTagKind {
pub(crate) enum VTagKind {
/// <style> tag
Style,
/// <script> tag
Expand All @@ -26,7 +26,7 @@ pub(crate) mod feat_ssr {
Other,
}

impl<T: AsRef<str>> From<T> for SpecialVTagKind {
impl<T: AsRef<str>> From<T> for VTagKind {
fn from(value: T) -> Self {
let value = value.as_ref();
if value.eq_ignore_ascii_case("style") {
Expand Down
8 changes: 4 additions & 4 deletions packages/yew/src/virtual_dom/vcomp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::html::Scoped;
#[cfg(any(feature = "ssr", feature = "csr"))]
use crate::html::{AnyScope, Scope};
#[cfg(feature = "ssr")]
use crate::{feat_ssr::SpecialVTagKind, platform::fmt::BufWriter};
use crate::{feat_ssr::VTagKind, platform::fmt::BufWriter};

/// A virtual component.
pub struct VComp {
Expand Down Expand Up @@ -77,7 +77,7 @@ pub(crate) trait Mountable {
w: &'a mut BufWriter,
parent_scope: &'a AnyScope,
hydratable: bool,
parent_vtag_kind: SpecialVTagKind,
parent_vtag_kind: VTagKind,
) -> LocalBoxFuture<'a, ()>;

#[cfg(feature = "hydration")]
Expand Down Expand Up @@ -147,7 +147,7 @@ impl<COMP: BaseComponent> Mountable for PropsWrapper<COMP> {
w: &'a mut BufWriter,
parent_scope: &'a AnyScope,
hydratable: bool,
parent_vtag_kind: SpecialVTagKind,
parent_vtag_kind: VTagKind,
) -> LocalBoxFuture<'a, ()> {
let scope: Scope<COMP> = Scope::new(Some(parent_scope.clone()));

Expand Down Expand Up @@ -264,7 +264,7 @@ mod feat_ssr {
w: &mut BufWriter,
parent_scope: &AnyScope,
hydratable: bool,
parent_vtag_kind: SpecialVTagKind,
parent_vtag_kind: VTagKind,
) {
self.mountable
.as_ref()
Expand Down
6 changes: 3 additions & 3 deletions packages/yew/src/virtual_dom/vlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ mod feat_ssr {
use futures::{join, pin_mut, poll, FutureExt};

use super::*;
use crate::feat_ssr::SpecialVTagKind;
use crate::feat_ssr::VTagKind;
use crate::html::AnyScope;
use crate::platform::fmt::{self, BufWriter};

Expand All @@ -192,7 +192,7 @@ mod feat_ssr {
w: &mut BufWriter,
parent_scope: &AnyScope,
hydratable: bool,
parent_vtag_kind: SpecialVTagKind,
parent_vtag_kind: VTagKind,
) {
match &self[..] {
[] => {}
Expand All @@ -207,7 +207,7 @@ mod feat_ssr {
w: &mut BufWriter,
parent_scope: &AnyScope,
hydratable: bool,
parent_vtag_kind: SpecialVTagKind,
parent_vtag_kind: VTagKind,
) where
I: Iterator<Item = &'a VNode>,
{
Expand Down
6 changes: 3 additions & 3 deletions packages/yew/src/virtual_dom/vnode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ mod feat_ssr {
use futures::future::{FutureExt, LocalBoxFuture};

use super::*;
use crate::feat_ssr::SpecialVTagKind;
use crate::feat_ssr::VTagKind;
use crate::html::AnyScope;
use crate::platform::fmt::BufWriter;

Expand All @@ -204,14 +204,14 @@ mod feat_ssr {
w: &'a mut BufWriter,
parent_scope: &'a AnyScope,
hydratable: bool,
parent_vtag_kind: SpecialVTagKind,
parent_vtag_kind: VTagKind,
) -> LocalBoxFuture<'a, ()> {
async fn render_into_stream_(
this: &VNode,
w: &mut BufWriter,
parent_scope: &AnyScope,
hydratable: bool,
parent_vtag_kind: SpecialVTagKind,
parent_vtag_kind: VTagKind,
) {
match this {
VNode::VTag(vtag) => vtag.render_into_stream(w, parent_scope, hydratable).await,
Expand Down
4 changes: 2 additions & 2 deletions packages/yew/src/virtual_dom/vsuspense.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl VSuspense {
#[cfg(feature = "ssr")]
mod feat_ssr {
use super::*;
use crate::feat_ssr::SpecialVTagKind;
use crate::feat_ssr::VTagKind;
use crate::html::AnyScope;
use crate::platform::fmt::BufWriter;
use crate::virtual_dom::Collectable;
Expand All @@ -38,7 +38,7 @@ mod feat_ssr {
w: &mut BufWriter,
parent_scope: &AnyScope,
hydratable: bool,
parent_vtag_kind: SpecialVTagKind,
parent_vtag_kind: VTagKind,
) {
let collectable = Collectable::Suspense;

Expand Down
4 changes: 2 additions & 2 deletions packages/yew/src/virtual_dom/vtag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ mod feat_ssr {
use std::fmt::Write;

use super::*;
use crate::feat_ssr::SpecialVTagKind;
use crate::feat_ssr::VTagKind;
use crate::html::AnyScope;
use crate::platform::fmt::BufWriter;
use crate::virtual_dom::VText;
Expand Down Expand Up @@ -506,7 +506,7 @@ mod feat_ssr {
VTagInner::Textarea { .. } => {
if let Some(m) = self.value() {
VText::new(m.to_owned())
.render_into_stream(w, parent_scope, hydratable, SpecialVTagKind::Other)
.render_into_stream(w, parent_scope, hydratable, VTagKind::Other)
.await;
}

Expand Down
10 changes: 5 additions & 5 deletions packages/yew/src/virtual_dom/vtext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ mod feat_ssr {
use std::fmt::Write;

use super::*;
use crate::feat_ssr::SpecialVTagKind;
use crate::feat_ssr::VTagKind;
use crate::html::AnyScope;
use crate::platform::fmt::BufWriter;

Expand All @@ -54,12 +54,12 @@ mod feat_ssr {
w: &mut BufWriter,
_parent_scope: &AnyScope,
_hydratable: bool,
parent_vtag_kind: SpecialVTagKind,
parent_vtag_kind: VTagKind,
) {
_ = w.write_str(&match parent_vtag_kind {
SpecialVTagKind::Style => html_escape::encode_style(&self.text),
SpecialVTagKind::Script => html_escape::encode_script(&self.text),
SpecialVTagKind::Other => html_escape::encode_text(&self.text),
VTagKind::Style => html_escape::encode_style(&self.text),
VTagKind::Script => html_escape::encode_script(&self.text),
VTagKind::Other => html_escape::encode_text(&self.text),
})
}
}
Expand Down

0 comments on commit 9949e9f

Please sign in to comment.