pub enum TsObjectEntry {
Prop(String, TsExpr),
Shorthand(String),
Method {
name: String,
is_async: bool,
generics: Vec<String>,
params: Vec<TsParam>,
return_type: Option<TsType>,
doc: Option<String>,
inline: bool,
body: Vec<TsStmt>,
},
Spread(TsExpr),
}Expand description
One entry of a TsExpr::Object literal. Only Prop existed before
#1321 (events_fanout.rs’s own grounding never needed the other three) —
workers.rs’s own dominant shape (Decision A, gap 1) is a literal
object whose entries are shorthand async methods (every on call/on http/… wrapper attaches this way), its local capability-deps object
mixes bare shorthand names with explicit key: value pairs, and three
real sites spread another object into one (gap 2, folded in here rather
than as its own top-level TsExpr variant — a spread only ever appears
as an object- or array-literal entry in this file, never as a
standalone expression, so scoping it to entry position is the narrower
correct change).
Variants§
Prop(String, TsExpr)
key: value.
Shorthand(String)
key alone — object-literal property shorthand, e.g. { cap1, cap2 }. Distinct from Prop(name, TsExpr::Ident(name)), which
prints name: name, not the shorthand form real TypeScript
property-shorthand text actually is.
Method
A shorthand async method entry, e.g. async foo(a: T) { ... }, —
workers.rs’s own dominant shape (Decision A, gap 1): every
wrapper helper (emit_call_wrapper, emit_event_wrapper, …)
attaches to the returned compose surface this way — none of
workers.rs’s own real sites annotates a return type, so
return_type stayed unneeded until #1323’s own real gap:
workers_entry.rs’s export default { fetch, scheduled?, queue? }
entries all carry one (: Promise<Response>/: Promise<void>), the
same field TsClassMethod::return_type already has for the
declaration-position sibling this mirrors.
generics and doc (#1337’s own real gaps, both found only by the
zero-diff fixture check — not the accepted proposal’s own citation,
which searched the project-form fixture corpus only;
402_generic_instance_method is single-file form, and while
65_money_uses_time/64_full_time_commons ARE project form, the
citation’s own doc-comment search used the wrong marker, ///
rather than this language’s real ----delimited doc block —
both gaps outside what that first pass actually checked):
generics: a method on a generic type erases to{name}<{generics}>(self: {Type}<{generics}>, …)—Box.map<A, U>, the type’s ownAplus the method’s ownU. Bare names only, no bounds/defaults — every real generic parameter list this tree ever builds is (matchingcrate::printer::print_type’s ownTsType::Named-only-name convention for the identical reason), so a fullVec<TsParam>(with its own unneededty/optionalfields) would be the wrong shape here.doc: a JSDoc block immediately preceding the method entry, at the same indent —Timestamp.diff/Timestamp.add(65_money_uses_time) both carry one. Printed the identical wayTsStmtKind::DocCommentis (same escaping, same blank-line convention), reusing that one renderer rather than a second copy — this field exists because an object-entry method has noTsStmtslot of its own to hold a preceding statement in.
Fields
inline: boolfalse (every method entry landed before #1337): body renders
as an ordinary braced, multi-line block. true: body renders
compactly on the SAME line as the signature — { <stmts>; },
reusing this crate’s own established compact-statement
machinery (TsStmtKind::InlineBlock’s own sibling shape). A
real gap #1337’s own zero-diff check found:
emit_forwarded_methods’s own pre-conversion writeln! always
built the WHOLE entry — signature and one-statement body alike —
on one physical line (" {method}({params}): {ret} {{ return …; }},"), a genuinely different real shape from every other
Method entry in this tree, all of which are multi-line.
Spread(TsExpr)
...expr — an object-spread entry (Decision A, gap 2), e.g. { ...deps, identity: __caller }.
Trait Implementations§
Source§impl Clone for TsObjectEntry
impl Clone for TsObjectEntry
Source§fn clone(&self) -> TsObjectEntry
fn clone(&self) -> TsObjectEntry
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for TsObjectEntry
impl RefUnwindSafe for TsObjectEntry
impl Send for TsObjectEntry
impl Sync for TsObjectEntry
impl Unpin for TsObjectEntry
impl UnsafeUnpin for TsObjectEntry
impl UnwindSafe for TsObjectEntry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);