There are net and webbing solutions, require installing fasteners or hooks. These can be rigged to keep a child from climbing out, until clever enough to unhook it, which for my grandson would have been about 14 months. He is mechanically inclined with strong problem solving skills. But different kids are different.
First owner of my RV used wire shelving, stuck the short end under the mattress. This would work to prevent an accidental roll out, but easily climbed over. I still have the pieces in my garage.
When we had bunk beds as children, for some of us a 2 inch rail prevented rolling out, others needed a foot-high fence. I wake up feeling the edge of a bed, my 60+ little brother still ends up on the floor without waking.
Solution depends on what you are trying to accomplish, and the individual.