Skip to content

Conversation

de-vri-es
Copy link
Contributor

This PR makes it possible to re-use a parsed template string more than once.

To preserve backwards compatibility the error types are a little but duplicate now, but I think it's worth it to avoid breaking compatibility.

This can also be used by #18 to implement the different expansion modes without breaking the API.

Comment on lines +23 to +26
* [`Template`]: borrows the source string.
* [`TemplateBuf`]: owns the source string.
* [`ByteTemplate`]: borrows the source bytes.
* [`ByteTemplateBuf`]: owns the source bytes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to bikeshed over the naming.

}
}

/// Parse a braced variable in the form of "${name[:default]} from source at the given position.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add an example of this to the README?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm? That's an internal function. Nobody can call it directly.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just meant this syntax: ${name[:default]}.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah it's there already. I just can't read.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right :)

@de-vri-es de-vri-es merged commit 5a3c5a2 into main Jun 25, 2024
@de-vri-es de-vri-es deleted the template branch June 25, 2024 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants