Standard disclaimer: I am not a lawyer.
In general, code is copyrighted the moment it is written. That means that you do not have any right to use someone else's code in any capacity by default. Not even if it is posted publicly. Keep in mind that whilst "fair use" is a thing, it is not a concrete right. Fair use is a defense, which means it doesn't come up until you've been sued for copyright infringement and you're in front of a judge, and there is no rigid standard for deciding what is and is not fair use. That will be decided by the judge/jury, so you cannot safely depend on it unless you're willing to go to court. If in doubt, retain a lawyer.
This is where licenses come in. A license does give you rights to use code. The specific rights you get depend on the license. Using someone else's code requires that you first determine how that code is licensed, and then consider whether the license gives you the permissions you need.
Again, to emphasise: I am not a lawyer. All of this is my best-effort understanding, and it's what I would feel comfortable doing for myself, but if you really want to be certain, you will have to find and talk to an actual copyright lawyer.
In the specific case of the source file you linked, there is no license listed in the file itself. That's less than ideal, and an explicit notice would be clearer.
However, if you check the root directory, you'll find the
LICENSE file for the
fltk repository. My assumption is that this license covers the contents of the repository unless otherwise specified.
This file is a copy of the MIT license. It is one of the simplest and most permissive licenses. It lets you use the covered code as you please, provided you include a notice with all distributions with a copyright notice (i.e. giving credit for the code you used), and a copy of the license. It also explicitly disclaims all warranties possible (i.e. if the code runs over your dog, it's your problem, not the author's).
You will want to become familiar with at least the basic meaning of the common licenses. There's quite a few resources you can look at; search for something like "common open source licenses explained".
If you're using that example as a starting point, you'd want to include a notice like "Portions copyright © 2021 The fltk-rs Authors." or similar with your project as well as a copy of the license itself (including both in source form, and compiled form). But that's also true of any dependencies you use. There are things like
cargo license that can help with identifying how your dependencies are licensed.