pub trait ExprHumanizer: Debug {
// Required methods
fn humanize_id(&self, id: GlobalId) -> Option<String>;
fn humanize_id_unqualified(&self, id: GlobalId) -> Option<String>;
fn humanize_id_parts(&self, id: GlobalId) -> Option<Vec<String>>;
fn humanize_scalar_type(&self, ty: &ScalarType) -> String;
fn column_names_for_id(&self, id: GlobalId) -> Option<Vec<String>>;
fn humanize_column(&self, id: GlobalId, column: usize) -> Option<String>;
fn id_exists(&self, id: GlobalId) -> bool;
// Provided method
fn humanize_column_type(&self, typ: &ColumnType) -> String { ... }
}
Expand description
A trait for humanizing components of an expression.
This will be most often used as part of the rendering context
type for various Display$Format
implementation.
Required Methods§
Sourcefn humanize_id(&self, id: GlobalId) -> Option<String>
fn humanize_id(&self, id: GlobalId) -> Option<String>
Attempts to return a human-readable string for the relation
identified by id
.
Sourcefn humanize_id_unqualified(&self, id: GlobalId) -> Option<String>
fn humanize_id_unqualified(&self, id: GlobalId) -> Option<String>
Same as above, but without qualifications, e.g., only foo
for materialize.public.foo
.
Sourcefn humanize_id_parts(&self, id: GlobalId) -> Option<Vec<String>>
fn humanize_id_parts(&self, id: GlobalId) -> Option<Vec<String>>
Like Self::humanize_id
, but returns the constituent parts of the
name as individual elements.
Sourcefn humanize_scalar_type(&self, ty: &ScalarType) -> String
fn humanize_scalar_type(&self, ty: &ScalarType) -> String
Returns a human-readable name for the specified scalar type.
Sourcefn column_names_for_id(&self, id: GlobalId) -> Option<Vec<String>>
fn column_names_for_id(&self, id: GlobalId) -> Option<Vec<String>>
Returns a vector of column names for the relation identified by id
.
Provided Methods§
Sourcefn humanize_column_type(&self, typ: &ColumnType) -> String
fn humanize_column_type(&self, typ: &ColumnType) -> String
Returns a human-readable name for the specified column type.
Trait Implementations§
Source§impl<'a, T> AsRef<&'a dyn ExprHumanizer> for PlanRenderingContext<'a, T>
impl<'a, T> AsRef<&'a dyn ExprHumanizer> for PlanRenderingContext<'a, T>
Source§fn as_ref(&self) -> &&'a dyn ExprHumanizer
fn as_ref(&self) -> &&'a dyn ExprHumanizer
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl<'a> AsRef<&'a dyn ExprHumanizer> for RenderingContext<'a>
impl<'a> AsRef<&'a dyn ExprHumanizer> for RenderingContext<'a>
Source§fn as_ref(&self) -> &&'a dyn ExprHumanizer
fn as_ref(&self) -> &&'a dyn ExprHumanizer
Converts this type into a shared reference of the (usually inferred) input type.