Actualiza nomenclatura de tipos

This commit is contained in:
Manuel Cillero 2022-05-15 20:12:59 +02:00
parent 72f5144b75
commit 96cbbb0c3c
24 changed files with 73 additions and 73 deletions

View file

@ -55,7 +55,7 @@ impl ComponentTrait for Anchor {
self.weight self.weight
} }
fn default_render(&self, _: &mut Context) -> Markup { fn default_render(&self, _: &mut InContext) -> Markup {
let target = match &self.target() { let target = match &self.target() {
AnchorTarget::Blank => Some("_blank"), AnchorTarget::Blank => Some("_blank"),
AnchorTarget::Context(name) => Some(name.as_str()), AnchorTarget::Context(name) => Some(name.as_str()),

View file

@ -5,7 +5,7 @@ pub const BLOCK_COMPONENT: &str = "pagetop::component::block";
pub struct Block { pub struct Block {
renderable: fn() -> bool, renderable: fn() -> bool,
weight : isize, weight : isize,
components: ComponentsHolder, components: ComponentsBundle,
title : OptAttr, title : OptAttr,
id : OptIden, id : OptIden,
classes : Classes, classes : Classes,
@ -17,7 +17,7 @@ impl ComponentTrait for Block {
Block { Block {
renderable: render_always, renderable: render_always,
weight : 0, weight : 0,
components: ComponentsHolder::new(), components: ComponentsBundle::new(),
title : OptAttr::new(), title : OptAttr::new(),
id : OptIden::new(), id : OptIden::new(),
classes : Classes::new_with_default("block"), classes : Classes::new_with_default("block"),
@ -37,7 +37,7 @@ impl ComponentTrait for Block {
self.weight self.weight
} }
fn default_render(&self, context: &mut Context) -> Markup { fn default_render(&self, context: &mut InContext) -> Markup {
let id = context.required_id::<Block>(self.id()); let id = context.required_id::<Block>(self.id());
html! { html! {
div id=(id) class=[self.classes()] { div id=(id) class=[self.classes()] {
@ -70,7 +70,7 @@ impl Block {
self self
} }
pub fn components(&self) -> &ComponentsHolder { pub fn components(&self) -> &ComponentsBundle {
&self.components &self.components
} }

View file

@ -31,7 +31,7 @@ impl ComponentTrait for Chunck {
self.weight self.weight
} }
fn default_render(&self, _: &mut Context) -> Markup { fn default_render(&self, _: &mut InContext) -> Markup {
html! { (*self.html()) } html! { (*self.html()) }
} }

View file

@ -7,7 +7,7 @@ pub enum ContainerType { Header, Footer, Main, Section, Wrapper }
pub struct Container { pub struct Container {
renderable : fn() -> bool, renderable : fn() -> bool,
weight : isize, weight : isize,
components : ComponentsHolder, components : ComponentsBundle,
container : ContainerType, container : ContainerType,
id : OptIden, id : OptIden,
classes : Classes, classes : Classes,
@ -20,7 +20,7 @@ impl ComponentTrait for Container {
Container { Container {
renderable : render_always, renderable : render_always,
weight : 0, weight : 0,
components : ComponentsHolder::new(), components : ComponentsBundle::new(),
container : ContainerType::Wrapper, container : ContainerType::Wrapper,
id : OptIden::new(), id : OptIden::new(),
classes : Classes::new_with_default("container"), classes : Classes::new_with_default("container"),
@ -41,7 +41,7 @@ impl ComponentTrait for Container {
self.weight self.weight
} }
fn default_render(&self, context: &mut Context) -> Markup { fn default_render(&self, context: &mut InContext) -> Markup {
match self.container_type() { match self.container_type() {
ContainerType::Header => html! { ContainerType::Header => html! {
header id=[self.id()] class=[self.classes()] { header id=[self.id()] class=[self.classes()] {
@ -120,7 +120,7 @@ impl Container {
self self
} }
pub fn components(&self) -> &ComponentsHolder { pub fn components(&self) -> &ComponentsBundle {
&self.components &self.components
} }

View file

@ -44,7 +44,7 @@ impl ComponentTrait for Button {
self.weight self.weight
} }
fn default_render(&self, _: &mut Context) -> Markup { fn default_render(&self, _: &mut InContext) -> Markup {
let button_type = match self.button_type() { let button_type = match self.button_type() {
ButtonType::Button => "button", ButtonType::Button => "button",
ButtonType::Reset => "reset", ButtonType::Reset => "reset",

View file

@ -52,7 +52,7 @@ impl ComponentTrait for Date {
self.weight self.weight
} }
fn default_render(&self, _: &mut Context) -> Markup { fn default_render(&self, _: &mut InContext) -> Markup {
let id = match self.name() { let id = match self.name() {
Some(name) => Some(concat_string!("edit-", name)), Some(name) => Some(concat_string!("edit-", name)),
None => None, None => None,

View file

@ -7,7 +7,7 @@ pub enum FormMethod {Get, Post}
pub struct Form { pub struct Form {
renderable: fn() -> bool, renderable: fn() -> bool,
weight : isize, weight : isize,
elements : ComponentsHolder, elements : ComponentsBundle,
action : OptAttr, action : OptAttr,
charset : OptAttr, charset : OptAttr,
method : FormMethod, method : FormMethod,
@ -21,7 +21,7 @@ impl ComponentTrait for Form {
Form { Form {
renderable: render_always, renderable: render_always,
weight : 0, weight : 0,
elements : ComponentsHolder::new(), elements : ComponentsBundle::new(),
action : OptAttr::new(), action : OptAttr::new(),
charset : OptAttr::new_with_value("UTF-8"), charset : OptAttr::new_with_value("UTF-8"),
method : FormMethod::Post, method : FormMethod::Post,
@ -43,7 +43,7 @@ impl ComponentTrait for Form {
self.weight self.weight
} }
fn default_render(&self, context: &mut Context) -> Markup { fn default_render(&self, context: &mut InContext) -> Markup {
let method = match self.method() { let method = match self.method() {
FormMethod::Get => None, FormMethod::Get => None,
FormMethod::Post => Some("post".to_owned()) FormMethod::Post => Some("post".to_owned())
@ -79,7 +79,7 @@ impl Form {
self self
} }
pub fn elements(&self) -> &ComponentsHolder { pub fn elements(&self) -> &ComponentsBundle {
&self.elements &self.elements
} }

View file

@ -25,7 +25,7 @@ impl ComponentTrait for Hidden {
self.weight self.weight
} }
fn default_render(&self, _: &mut Context) -> Markup { fn default_render(&self, _: &mut InContext) -> Markup {
let id = match self.name() { let id = match self.name() {
Some(name) => Some(concat_string!("value-", name)), Some(name) => Some(concat_string!("value-", name)),
_ => None _ => None

View file

@ -62,14 +62,14 @@ impl ComponentTrait for Input {
self.weight self.weight
} }
fn before_render(&mut self, _: &mut Context) { fn before_render(&mut self, _: &mut InContext) {
if let Some(name) = self.name() { if let Some(name) = self.name() {
let class = concat_string!("form-item-", name); let class = concat_string!("form-item-", name);
self.alter_classes(class.as_str(), ClassesOp::AddFirst); self.alter_classes(class.as_str(), ClassesOp::AddFirst);
} }
} }
fn default_render(&self, _: &mut Context) -> Markup { fn default_render(&self, _: &mut InContext) -> Markup {
let type_input = match self.input_type() { let type_input = match self.input_type() {
InputType::Email => "email", InputType::Email => "email",
InputType::Password => "password", InputType::Password => "password",

View file

@ -5,7 +5,7 @@ pub const COLUMN_COMPONENT: &str = "pagetop::component::grid::column";
pub struct Column { pub struct Column {
renderable: fn() -> bool, renderable: fn() -> bool,
weight : isize, weight : isize,
components: ComponentsHolder, components: ComponentsBundle,
id : OptIden, id : OptIden,
classes : Classes, classes : Classes,
template : String, template : String,
@ -16,7 +16,7 @@ impl ComponentTrait for Column {
Column { Column {
renderable: render_always, renderable: render_always,
weight : 0, weight : 0,
components: ComponentsHolder::new(), components: ComponentsBundle::new(),
id : OptIden::new(), id : OptIden::new(),
classes : Classes::new_with_default("col"), classes : Classes::new_with_default("col"),
template : "default".to_owned(), template : "default".to_owned(),
@ -35,7 +35,7 @@ impl ComponentTrait for Column {
self.weight self.weight
} }
fn default_render(&self, context: &mut Context) -> Markup { fn default_render(&self, context: &mut InContext) -> Markup {
html! { html! {
div id=[self.id()] class=[self.classes()] { div id=[self.id()] class=[self.classes()] {
(self.components().render(context)) (self.components().render(context))
@ -61,7 +61,7 @@ impl Column {
self self
} }
pub fn components(&self) -> &ComponentsHolder { pub fn components(&self) -> &ComponentsBundle {
&self.components &self.components
} }

View file

@ -5,7 +5,7 @@ pub const ROW_COMPONENT: &str = "pagetop::component::grid::row";
pub struct Row { pub struct Row {
renderable: fn() -> bool, renderable: fn() -> bool,
weight : isize, weight : isize,
columns : ComponentsHolder, columns : ComponentsBundle,
id : OptIden, id : OptIden,
classes : Classes, classes : Classes,
template : String, template : String,
@ -16,7 +16,7 @@ impl ComponentTrait for Row {
Row { Row {
renderable: render_always, renderable: render_always,
weight : 0, weight : 0,
columns : ComponentsHolder::new(), columns : ComponentsBundle::new(),
id : OptIden::new(), id : OptIden::new(),
classes : Classes::new_with_default("row"), classes : Classes::new_with_default("row"),
template : "default".to_owned(), template : "default".to_owned(),
@ -35,7 +35,7 @@ impl ComponentTrait for Row {
self.weight self.weight
} }
fn default_render(&self, context: &mut Context) -> Markup { fn default_render(&self, context: &mut InContext) -> Markup {
html! { html! {
div id=[self.id()] class=[self.classes()] { div id=[self.id()] class=[self.classes()] {
(self.columns().render(context)) (self.columns().render(context))
@ -61,7 +61,7 @@ impl Row {
self self
} }
pub fn columns(&self) -> &ComponentsHolder { pub fn columns(&self) -> &ComponentsBundle {
&self.columns &self.columns
} }

View file

@ -50,7 +50,7 @@ impl ComponentTrait for Heading {
self.weight self.weight
} }
fn default_render(&self, _: &mut Context) -> Markup { fn default_render(&self, _: &mut InContext) -> Markup {
html! { @match &self.heading() { html! { @match &self.heading() {
HeadingType::H1 => h1 id=[self.id()] class=[self.classes()] { (*self.html()) }, HeadingType::H1 => h1 id=[self.id()] class=[self.classes()] { (*self.html()) },
HeadingType::H2 => h2 id=[self.id()] class=[self.classes()] { (*self.html()) }, HeadingType::H2 => h2 id=[self.id()] class=[self.classes()] { (*self.html()) },

View file

@ -35,7 +35,7 @@ impl ComponentTrait for Image {
self.weight self.weight
} }
fn default_render(&self, _: &mut Context) -> Markup { fn default_render(&self, _: &mut InContext) -> Markup {
html! { html! {
img img
src=[self.source()] src=[self.source()]

View file

@ -42,7 +42,7 @@ impl ComponentTrait for MenuItem {
self.weight self.weight
} }
fn default_render(&self, context: &mut Context) -> Markup { fn default_render(&self, context: &mut InContext) -> Markup {
match self.item_type() { match self.item_type() {
MenuItemType::Label(label) => html! { MenuItemType::Label(label) => html! {
li class="label" { a href="#" { (label) } } li class="label" { a href="#" { (label) } }
@ -176,7 +176,7 @@ impl MenuItem {
pub struct Menu { pub struct Menu {
renderable: fn() -> bool, renderable: fn() -> bool,
weight : isize, weight : isize,
items : ComponentsHolder, items : ComponentsBundle,
id : OptIden, id : OptIden,
classes : Classes, classes : Classes,
template : String, template : String,
@ -187,7 +187,7 @@ impl ComponentTrait for Menu {
Menu { Menu {
renderable: render_always, renderable: render_always,
weight : 0, weight : 0,
items : ComponentsHolder::new(), items : ComponentsBundle::new(),
id : OptIden::new(), id : OptIden::new(),
classes : Classes::new_with_default("sm sm-clean"), classes : Classes::new_with_default("sm sm-clean"),
template : "default".to_owned(), template : "default".to_owned(),
@ -206,7 +206,7 @@ impl ComponentTrait for Menu {
self.weight self.weight
} }
fn default_render(&self, context: &mut Context) -> Markup { fn default_render(&self, context: &mut InContext) -> Markup {
context context
.add_stylesheet(StyleSheet::source( .add_stylesheet(StyleSheet::source(
"/theme/menu/css/menu.css?ver=1.1.1" "/theme/menu/css/menu.css?ver=1.1.1"
@ -251,7 +251,7 @@ impl Menu {
self self
} }
pub fn items(&self) -> &ComponentsHolder { pub fn items(&self) -> &ComponentsBundle {
&self.items &self.items
} }

View file

@ -46,7 +46,7 @@ impl ComponentTrait for Paragraph {
self.weight self.weight
} }
fn default_render(&self, _: &mut Context) -> Markup { fn default_render(&self, _: &mut InContext) -> Markup {
html! { html! {
p id=[self.id()] class=[self.classes()] { (*self.html()) } p id=[self.id()] class=[self.classes()] { (*self.html()) }
} }

View file

@ -33,7 +33,7 @@ impl ThemeTrait for Bulmix {
fn before_render_component( fn before_render_component(
&self, &self,
component: &mut dyn ComponentTrait, component: &mut dyn ComponentTrait,
_context: &mut Context _context: &mut InContext
) { ) {
match component.handler() { match component.handler() {
HEADING_COMPONENT => { HEADING_COMPONENT => {

View file

@ -5,8 +5,8 @@ pub use hook::{
}; };
mod context; mod context;
pub use context::InContext;
pub use context::{ pub use context::{
Context,
Favicon, Favicon,
JavaScript, JSMode, JavaScript, JSMode,
StyleSheet, StyleSheet,
@ -21,8 +21,8 @@ pub use definition::{
}; };
use definition::render_component; use definition::render_component;
mod holder; mod bundle;
pub use holder::ComponentsHolder; pub use bundle::ComponentsBundle;
mod all; mod all;
pub use all::add_component_to; pub use all::add_component_to;

View file

@ -1,10 +1,10 @@
use crate::Lazy; use crate::Lazy;
use super::{ComponentsHolder, ComponentTrait}; use super::{ComponentsBundle, ComponentTrait};
use std::sync::RwLock; use std::sync::RwLock;
use std::collections::HashMap; use std::collections::HashMap;
static COMPONENTS: Lazy<RwLock<HashMap<&str, ComponentsHolder>>> = Lazy::new(|| { static COMPONENTS: Lazy<RwLock<HashMap<&str, ComponentsBundle>>> = Lazy::new(|| {
RwLock::new(HashMap::new()) RwLock::new(HashMap::new())
}); });
@ -13,10 +13,10 @@ pub fn add_component_to(region: &'static str, component: impl ComponentTrait) {
if let Some(regions) = hmap.get_mut(region) { if let Some(regions) = hmap.get_mut(region) {
regions.add(component); regions.add(component);
} else { } else {
hmap.insert(region, ComponentsHolder::new_with(component)); hmap.insert(region, ComponentsBundle::new_with(component));
} }
} }
pub fn common_components() -> HashMap<&'static str, ComponentsHolder> { pub fn common_components() -> HashMap<&'static str, ComponentsBundle> {
COMPONENTS.read().unwrap().clone() COMPONENTS.read().unwrap().clone()
} }

View file

@ -1,18 +1,18 @@
use crate::html::{Markup, html}; use crate::html::{Markup, html};
use super::{Context, ComponentTrait}; use super::{InContext, ComponentTrait};
use std::sync::{Arc, RwLock}; use std::sync::{Arc, RwLock};
#[derive(Clone)] #[derive(Clone)]
pub struct ComponentsHolder(Vec<Arc<RwLock<dyn ComponentTrait>>>); pub struct ComponentsBundle(Vec<Arc<RwLock<dyn ComponentTrait>>>);
impl ComponentsHolder { impl ComponentsBundle {
pub fn new() -> Self { pub fn new() -> Self {
ComponentsHolder(Vec::new()) ComponentsBundle(Vec::new())
} }
pub fn new_with(component: impl ComponentTrait) -> Self { pub fn new_with(component: impl ComponentTrait) -> Self {
let mut container = ComponentsHolder::new(); let mut container = ComponentsBundle::new();
container.add(component); container.add(component);
container container
} }
@ -21,7 +21,7 @@ impl ComponentsHolder {
self.0.push(Arc::new(RwLock::new(component))); self.0.push(Arc::new(RwLock::new(component)));
} }
pub fn render(&self, context: &mut Context) -> Markup { pub fn render(&self, context: &mut InContext) -> Markup {
let mut components = self.0.clone(); let mut components = self.0.clone();
components.sort_by_key(|c| c.read().unwrap().weight()); components.sort_by_key(|c| c.read().unwrap().weight());
html! { html! {

View file

@ -19,7 +19,7 @@ static DEFAULT_THEME: Lazy<&dyn ThemeTrait> = Lazy::new(|| {
} }
}); });
pub struct Context { pub struct InContext {
theme : &'static dyn ThemeTrait, theme : &'static dyn ThemeTrait,
favicon : Option<Favicon>, favicon : Option<Favicon>,
metadata : Vec<(String, String)>, metadata : Vec<(String, String)>,
@ -29,9 +29,9 @@ pub struct Context {
id_counter : usize, id_counter : usize,
} }
impl Context { impl InContext {
pub fn new() -> Self { pub fn new() -> Self {
Context { InContext {
theme : *DEFAULT_THEME, theme : *DEFAULT_THEME,
favicon : None, favicon : None,
metadata : Vec::new(), metadata : Vec::new(),
@ -93,20 +93,20 @@ impl Context {
self self
} }
/// Context GETTERS. /// InContext GETTERS.
pub(crate) fn theme(&mut self) -> &'static dyn ThemeTrait { pub(crate) fn theme(&mut self) -> &'static dyn ThemeTrait {
self.theme self.theme
} }
/// Context RENDER. /// InContext RENDER.
pub fn render(&mut self) -> Markup { pub fn render(&mut self) -> Markup {
let ordered_css = &mut self.stylesheets; let ordered_css = &mut self.stylesheets;
ordered_css.sort_by_key(|o| o.weight); ordered_css.sort_by_key(|css| css.weight);
let ordered_js = &mut self.javascripts; let ordered_js = &mut self.javascripts;
ordered_js.sort_by_key(|o| o.weight); ordered_js.sort_by_key(|js| js.weight);
html! { html! {
@match &self.favicon { @match &self.favicon {
@ -125,7 +125,7 @@ impl Context {
} }
} }
// Context EXTRAS. // InContext EXTRAS.
pub fn required_id<T>(&mut self, id: &Option<String>) -> String { pub fn required_id<T>(&mut self, id: &Option<String>) -> String {
match id { match id {

View file

@ -1,7 +1,7 @@
use crate::util; use crate::util;
use crate::html::{Markup, html}; use crate::html::{Markup, html};
use crate::core::hook::{hook_ref, run_hooks}; use crate::core::hook::{hook_ref, run_hooks};
use super::{BEFORE_RENDER_COMPONENT_HOOK, BeforeRenderComponentHook, Context}; use super::{BEFORE_RENDER_COMPONENT_HOOK, BeforeRenderComponentHook, InContext};
pub use std::any::Any as AnyComponent; pub use std::any::Any as AnyComponent;
@ -27,11 +27,11 @@ pub trait ComponentTrait: AnyComponent + Send + Sync {
} }
#[allow(unused_variables)] #[allow(unused_variables)]
fn before_render(&mut self, context: &mut Context) { fn before_render(&mut self, context: &mut InContext) {
} }
#[allow(unused_variables)] #[allow(unused_variables)]
fn default_render(&self, context: &mut Context) -> Markup { fn default_render(&self, context: &mut InContext) -> Markup {
html! {} html! {}
} }
@ -48,7 +48,7 @@ pub fn component_mut<C: 'static>(component: &mut dyn ComponentTrait) -> &mut C {
component.as_mut_any().downcast_mut::<C>().unwrap() component.as_mut_any().downcast_mut::<C>().unwrap()
} }
pub fn render_component(component: &mut dyn ComponentTrait, context: &mut Context) -> Markup { pub fn render_component(component: &mut dyn ComponentTrait, context: &mut InContext) -> Markup {
// Acciones del componente antes de renderizar. // Acciones del componente antes de renderizar.
component.before_render(context); component.before_render(context);

View file

@ -1,10 +1,10 @@
use crate::core::hook::{HookTrait, AnyHook}; use crate::core::hook::{HookTrait, AnyHook};
use super::{ComponentTrait, Context}; use super::{ComponentTrait, InContext};
pub const BEFORE_RENDER_COMPONENT_HOOK: &str = "pagetop::hook::before_render_component"; pub const BEFORE_RENDER_COMPONENT_HOOK: &str = "pagetop::hook::before_render_component";
pub struct BeforeRenderComponentHook { pub struct BeforeRenderComponentHook {
hook: Option<fn(&mut dyn ComponentTrait, &mut Context)>, hook: Option<fn(&mut dyn ComponentTrait, &mut InContext)>,
weight: isize, weight: isize,
} }
@ -30,7 +30,7 @@ impl HookTrait for BeforeRenderComponentHook {
} }
impl BeforeRenderComponentHook { impl BeforeRenderComponentHook {
pub fn with_hook(mut self, hook: fn(&mut dyn ComponentTrait, &mut Context)) -> Self { pub fn with_hook(mut self, hook: fn(&mut dyn ComponentTrait, &mut InContext)) -> Self {
self.hook = Some(hook); self.hook = Some(hook);
self self
} }
@ -40,7 +40,7 @@ impl BeforeRenderComponentHook {
self self
} }
pub fn run(&self, component: &mut dyn ComponentTrait, context: &mut Context) { pub fn run(&self, component: &mut dyn ComponentTrait, context: &mut InContext) {
if let Some(hook) = self.hook { if let Some(hook) = self.hook {
hook(component, context) hook(component, context)
} }

View file

@ -2,7 +2,7 @@ use crate::{concat_string, util};
use crate::config::SETTINGS; use crate::config::SETTINGS;
use crate::html::{Markup, html}; use crate::html::{Markup, html};
use crate::core::app; use crate::core::app;
use crate::core::component::{ComponentTrait, Context, Favicon}; use crate::core::component::{ComponentTrait, Favicon, InContext};
use crate::response::page::Page; use crate::response::page::Page;
use crate::base::component::Chunck; use crate::base::component::Chunck;
@ -86,7 +86,7 @@ pub trait ThemeTrait: BaseTheme + Send + Sync {
fn before_render_component( fn before_render_component(
&self, &self,
component: &mut dyn ComponentTrait, component: &mut dyn ComponentTrait,
context: &mut Context context: &mut InContext
) { ) {
/* /*
Cómo usarlo: Cómo usarlo:
@ -105,7 +105,7 @@ pub trait ThemeTrait: BaseTheme + Send + Sync {
fn render_component( fn render_component(
&self, &self,
component: &dyn ComponentTrait, component: &dyn ComponentTrait,
context: &mut Context context: &mut InContext
) -> Option<Markup> { ) -> Option<Markup> {
None None
/* /*

View file

@ -42,8 +42,8 @@ pub struct Page<'a> {
direction : OptAttr, direction : OptAttr,
title : OptAttr, title : OptAttr,
description : OptAttr, description : OptAttr,
context : Context, context : InContext,
regions : HashMap<&'a str, ComponentsHolder>, regions : HashMap<&'a str, ComponentsBundle>,
body_classes: Classes, body_classes: Classes,
template : String, template : String,
} }
@ -62,7 +62,7 @@ impl<'a> Page<'a> {
}, },
title : OptAttr::new(), title : OptAttr::new(),
description : OptAttr::new(), description : OptAttr::new(),
context : Context::new(), context : InContext::new(),
regions : common_components(), regions : common_components(),
body_classes: Classes::new_with_default("body"), body_classes: Classes::new_with_default("body"),
template : "default".to_owned(), template : "default".to_owned(),
@ -103,7 +103,7 @@ impl<'a> Page<'a> {
if let Some(regions) = self.regions.get_mut(region) { if let Some(regions) = self.regions.get_mut(region) {
regions.add(component); regions.add(component);
} else { } else {
self.regions.insert(region, ComponentsHolder::new_with(component)); self.regions.insert(region, ComponentsBundle::new_with(component));
} }
self self
} }
@ -136,7 +136,7 @@ impl<'a> Page<'a> {
self.description.option() self.description.option()
} }
pub fn context(&mut self) -> &mut Context { pub fn context(&mut self) -> &mut InContext {
&mut self.context &mut self.context
} }