Skip to content

Commit 4ab5538

Browse files
committed
docs(parser): add documentation for Result<bool> pattern and parameter counts
- Document Ok(true)/Ok(false) return semantics for tag handling functions - Clarify parse_item tuple return value (Entry, has_errors) - Add notes about borrow checker constraints for 8-parameter functions - Document Result return type consistency in parse_podcast_transcript
1 parent 69dfe3e commit 4ab5538

File tree

1 file changed

+23
-1
lines changed
  • crates/feedparser-rs-core/src/parser

1 file changed

+23
-1
lines changed

crates/feedparser-rs-core/src/parser/rss.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ fn parse_channel_standard(
313313
}
314314

315315
/// Parse iTunes namespace tags at channel level
316+
///
317+
/// Returns `Ok(true)` if the tag was recognized and handled, `Ok(false)` if not recognized.
316318
fn parse_channel_itunes(
317319
reader: &mut Reader<&[u8]>,
318320
buf: &mut Vec<u8>,
@@ -434,6 +436,8 @@ fn parse_itunes_category(
434436
}
435437

436438
/// Parse Podcast 2.0 namespace tags at channel level
439+
///
440+
/// Returns `Ok(true)` if the tag was recognized and handled, `Ok(false)` if not recognized.
437441
#[inline]
438442
fn parse_channel_podcast(
439443
reader: &mut Reader<&[u8]>,
@@ -493,7 +497,10 @@ fn parse_channel_namespace(
493497
}
494498

495499
/// Parse <item> element (entry)
496-
/// Returns Result with Entry and boolean indicating if there were attribute parsing errors
500+
///
501+
/// Returns a tuple where:
502+
/// - First element: the parsed `Entry`
503+
/// - Second element: `bool` indicating whether attribute parsing errors occurred (for bozo flag)
497504
fn parse_item(
498505
reader: &mut Reader<&[u8]>,
499506
buf: &mut Vec<u8>,
@@ -641,6 +648,8 @@ fn parse_item_standard(
641648
}
642649

643650
/// Parse iTunes namespace tags at item level
651+
///
652+
/// Returns `Ok(true)` if the tag was recognized and handled, `Ok(false)` if not recognized.
644653
#[inline]
645654
fn parse_item_itunes(
646655
reader: &mut Reader<&[u8]>,
@@ -697,6 +706,11 @@ fn parse_item_itunes(
697706
}
698707

699708
/// Parse Podcast 2.0 namespace tags at item level
709+
///
710+
/// Returns `Ok(true)` if the tag was recognized and handled, `Ok(false)` if not recognized.
711+
///
712+
/// Note: Uses 8 parameters instead of a context struct due to borrow checker constraints
713+
/// with multiple simultaneous `&mut` references during parsing.
700714
#[inline]
701715
#[allow(clippy::too_many_arguments)]
702716
fn parse_item_podcast(
@@ -721,6 +735,9 @@ fn parse_item_podcast(
721735
}
722736

723737
/// Parse Podcast 2.0 transcript element
738+
///
739+
/// Note: Currently always returns `Ok(())` but uses `Result` return type
740+
/// for consistency with other parsers and potential future error handling.
724741
fn parse_podcast_transcript(
725742
reader: &mut Reader<&[u8]>,
726743
buf: &mut Vec<u8>,
@@ -788,6 +805,11 @@ fn parse_podcast_person(
788805
}
789806

790807
/// Parse Dublin Core, Content, and Media RSS namespace tags at item level
808+
///
809+
/// Returns `Ok(true)` if the tag was recognized and handled, `Ok(false)` if not recognized.
810+
///
811+
/// Note: Uses 8 parameters instead of a context struct due to borrow checker constraints
812+
/// with multiple simultaneous `&mut` references during parsing.
791813
#[inline]
792814
#[allow(clippy::too_many_arguments)]
793815
fn parse_item_namespace(

0 commit comments

Comments
 (0)