Skip to content

hreffdev/mark-henry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mark Henry

A standalone and robust markdown parser to satisfy its own ego

src/ ├── lib.rs <-- The Root (Registers all other files) ├── config.rs <-- Constants (Repo, User, Branch) ├── types.rs <-- Structs (MenuItem, RenderedPage) ├── parser.rs <-- Markdown parsing logic ├── utils.rs <-- DOM helpers (Observer, Highlighting) └── app.rs <-- The Main Yew Component

some really good notes

  1. for web-sys, setter-style methods mutate self and return &mut Self.

  2. This is a closure, sort of a hook in the case where

   || → a closure that takes no arguments
   () → returns the unit type

“A function that takes and return but it return nothing and does nothing.”

  1. The expected signature (conceptually).
   FnOnce() -> impl FnOnce()

Meaning:

The effect runs once (or when deps change) It returns a cleanup function The cleanup function runs when:

  • the component unmounts, or
  • the dependencies change

When NO cleanup to perform, there are something must be return.

That “something” is:

|| ()

example in the case of hook cases

use_effect(move || {
    let observer = create_observer();

    // with cleanup
    || {
        observer.disconnect();
    }
});
use_effect(move || {
    setup_observer();

    // no cleanup 
    || ()
});

Rust will shout error if it doent return. but omit something will cause error as well as it will not return expected types.

use_effect(move || {
    //try to omit value from closure 
    setup_observer();
});

So somehow something must be return which is nothing

It satisfies the type system by saying:

“Here i shall return it back to you, but its nothing, and doesnt do anothing. But atleast you know"

About

Just a standalone markdown parser that is robust and solid

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages