How does vertex snapping work?

Not sure if this is the right place to ask.

I’m working on a vertex snapping algorithm in C#, and was curious how Blender’s actually works.

I looked through the code here: blender/transform_snap_object.c at 594f47ecd2d5367ca936cf6fc6ec8168c2b360d0 · blender/blender · GitHub
but being new to the codebase, I’m not sure if this is the right place to look.

Any guidance would be greatly appreciated.