mirror of
https://github.com/oxc-project/oxc.git
synced 2026-11-04 10:29:58 +00:00
feat(formatter_core): expose SourceText::as_str() (#24281)
For updating `oxc-css-parser` to 0.0.6, which contains breaking changes.
This commit is contained in:
1 parent
eeb1913380
commit
a9a5cd630d
1 file changed
+10
@@ -32,6 +32,16 @@ impl<'a> SourceText<'a> {
|
||||
Self { text }
|
||||
}
|
||||
|
||||
/// The full source as `&'a str`.
|
||||
///
|
||||
/// `Deref<Target = str>` re-borrows through `&self`,
|
||||
/// which is too short for consumers that need source-lifetime slices.
|
||||
/// (e.g. `oxc-css-parser` has span-backed accessors whose results reach the `text()` builder)
|
||||
/// This hands back the `'a`-lived text itself.
|
||||
pub fn as_str(&self) -> &'a str {
|
||||
self.text
|
||||
}
|
||||
|
||||
// Text slicing
|
||||
/// Get text between two positions
|
||||
pub fn slice_range(&self, start: u32, end: u32) -> &'a str {
|
||||
|
||||
Reference in new issue
Block a user