Trait rspack_sources::Source

source ·
pub trait Source: StreamChunks + DynHash + AsAny + DynEq + DynClone + Debug + Sync + Send {
    // Required methods
    fn source(&self) -> Cow<'_, str>;
    fn buffer(&self) -> Cow<'_, [u8]>;
    fn size(&self) -> usize;
    fn map(&self, options: &MapOptions) -> Option<SourceMap>;
    fn to_writer(&self, writer: &mut dyn Write) -> Result<()>;

    // Provided method
    fn update_hash(&self, state: &mut dyn Hasher) { ... }
}
Expand description

Required Methods§

source

fn source(&self) -> Cow<'_, str>

Get the source code.

source

fn buffer(&self) -> Cow<'_, [u8]>

Get the source buffer.

source

fn size(&self) -> usize

Get the size of the source.

source

fn map(&self, options: &MapOptions) -> Option<SourceMap>

Get the SourceMap.

source

fn to_writer(&self, writer: &mut dyn Write) -> Result<()>

Writes the source into a writer, preferably a std::io::BufWriter<std::io::Write>.

Provided Methods§

source

fn update_hash(&self, state: &mut dyn Hasher)

Update hash based on the source.

Trait Implementations§

source§

impl Hash for dyn Source

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
source§

impl PartialEq for dyn Source

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for dyn Source

Implementors§