~zethra/linicon

98dedfe290e075ba816e1a82747eab5a1dd0d519 — zethra 3 months ago c4685d3
Added panic warnings to methods
1 files changed, 10 insertions(+), 0 deletions(-)

M src/lib.rs
M src/lib.rs => src/lib.rs +10 -0
@@ 323,6 323,8 @@ impl<'a> IconIter<'a> {
    /// theme if the `system-theme` feature is enabled (on by default) and the
    /// user's theme can be determined otherwise the default hicolor theme will
    /// be used.
    ///
    /// Will panic if called after calling next.
    pub fn from_theme(mut self, theme_name: impl AsRef<str>) -> Self {
        if self.state.is_some() {
            panic!("linicon: Cannot change icon iterator settings after iteration has started");


@@ 332,6 334,8 @@ impl<'a> IconIter<'a> {
    }

    /// Search for an icon of the given size.
    ///
    /// Will panic if called after calling next.
    pub fn with_size(mut self, size: u16) -> Self {
        if self.state.is_some() {
            panic!("linicon: Cannot change icon iterator settings after iteration has started");


@@ 341,6 345,8 @@ impl<'a> IconIter<'a> {
    }

    /// Search for an icon for use with the given UI scale.
    ///
    /// Will panic if called after calling next.
    pub fn with_scale(mut self, scale: u16) -> Self {
        if self.state.is_some() {
            panic!("linicon: Cannot change icon iterator settings after iteration has started");


@@ 358,6 364,8 @@ impl<'a> IconIter<'a> {
    /// [`shellexpand::full`](https://docs.rs/shellexpand/2.0.0/shellexpand/fn.full.html).
    ///
    /// This function will never return an error if the `expand-paths` feature is turned off.
    ///
    /// Will panic if called after calling next.
    pub fn with_search_paths(
        mut self,
        extra_search_paths: &[impl AsRef<str>],


@@ 375,6 383,8 @@ impl<'a> IconIter<'a> {
    /// Normally, once the iterator has exhausted icons that match the given parameters,
    /// the iterator will search through the icon theme's fallback themes.  Setting this
    /// to false will prevent this behavior so that the icons will all be from the given theme.
    ///
    /// Will panic if called after calling next.
    pub fn use_fallback_themes(mut self, use_fallback: bool) -> Self {
        if self.state.is_some() {
            panic!("linicon: Cannot change icon iterator settings after iteration has started");